Integration Testing Kotlin Multiplatform Kata for Kotlin Developers. The main goal is to practice integration testing using Ktor and Ktor Client Mock

Overview

integration-testing-kotlin-multiplatform

Build Status Awesome Kotlin Badge

This kata is a Kotlin multiplatform version of the kata KataTODOApiClientKotlin of Karumi.

  • We are here to practice integration testing using HTTP stubbing.
  • We are going to use KtorClientMock to return stub responses.
  • We are going to use KotlinTest to write tests and to perform assertions.
  • We are going to practice pair programming.

Getting started

This repository contains an kotlin multiplatform library with an API client to interact with the JSONPlaceholder service.

This API Client is based on one class with name TodoApiClient containing some methods to interact with the API. Using this class we can get all the tasks, get a task using the task id, add a new task, update a task or delete an already created task.

The API client has been implemented using a multiplatform networking framework named Ktor. Review the project documentation if needed.

Tasks

Your task as a multiplatform Kotlin Developer is to write all the integration tests needed to check if the API Client is working as expected.

This repository is ready to build the application, pass the checkstyle using ktlint and your tests in Travis-CI environments.

My recommendation for this exercise is:

  • Before starting

    1. Fork this repository.
    2. Checkout integration-testing-kotlin-multiplatform-kata branch.
    3. Execute the repository playground and make yourself familiar with the code.
    4. Execute TodoApiClientShould and watch the only test it contains pass.
  • To help you get started, these are some tests already written at TodoApiClientShould class. Review it carefully before to start writing your own tests. Here you have the description of some tests you can write to start working on this Kata:

    1. Test that the Accept headers are sent.
    2. Test that the list of Task instances obtained invoking the getter method of the property allTasks contains the expected values.
    3. Test that the request is sent to the correct path using the correct HTTP method.
    4. Test that adding a task the body sent to the server is the correct one.

Considerations

  • If you get stuck, master branch contains all the tests already solved.

  • You will find some utilities to help you test the APIClient easily in: TodoApiMockEngine and the common/responses directory in commonTest source set.

Extra Tasks

If you've covered all the application functionality using integration tests you can continue with some extra tasks:


Documentation

There are some links which can be useful to finish these tasks:

License

Copyright 2019 Jorge Sánchez Fernández

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

You might also like...
A reliable android app that shows upcoming fixtures, updated league tables, and top goal scorers in a league
A reliable android app that shows upcoming fixtures, updated league tables, and top goal scorers in a league

SwiftScore A football stats and livescore app built with Kotlin,MVVM architecture,Retrofit, Coroutines and Navigation Components Demo Screenshots API

PlaceAutoComplete - Practice Repository for placesearch using google places Api
PlaceAutoComplete - Practice Repository for placesearch using google places Api

PlaceAutoComplete Practice Repository for placesearch using google places Api Ap

The home of the amigo-platform which serves as the main service for the amigo multimedia platform

amigo-platform This is the home of the amigo-platform which serves as the main service for the amigo multimedia platform. Authentication with JWT Toke

This app works as a simple replacement for SpongeAuth for those who want to use Discourse as the main SSO auth provider.

PowerNukkit Ore to Discourse Auth Gateway This app works as a simple replacement for SpongeAuth for those who want to use Discourse as the main SSO au

SSU u-saint parser with Kotlin-Multiplatform and Ktor.

kusaint Soongsil University(SSU) u-Saint Parser with Kotlin Multiplatform. Prerequisites JVM !!IMPORTANT!! To run kusaint as a library in JVM environm

This is a practice app. An app that you can find random recipes and choose the ones you like.
This is a practice app. An app that you can find random recipes and choose the ones you like.

A food suggestion app like Tinder This is a practice app. In this app, you can find random recipes and choose the ones you like. This is main menu. Yo

Solutions to Hackerrank and CoderByte practice problems
Solutions to Hackerrank and CoderByte practice problems

Solutions to Hackerrank and CoderByte practice problems This repository contains solutions to CoderByte and Hackerrank practice problems with Kotlin.

In this single activity app. i was trying to practice on ViewModel and Livedata

CalwithViewModel In this single activity app. i was trying to practice on ViewModel and Livedata Min Api Level : 19 Setup Requirements Android device

Basic RestAPI to practice my skills working with Spring/Kotlin/Gradle

Dining Review API Dining Review API is a basic RestAPI roughly based on the requirements given in a Milestone project in the Building REST APIs with J

Owner
Jorge Sánchez Fernández
Freelance developer passionate about software development focuses on new technologies particular emphasis on Architecture, Best Practices, clean code and tests.
Jorge Sánchez Fernández
Maxibon kata for Kotlin Developers. The main goal is to practice property based testing.

Kata Maxibon for Kotlin. We are here to practice property based testing. We are going to use KotlinTest to write our tests. We are going to practice p

Karumi 44 Oct 3, 2022
Screenshot Kata for Android Developers with Kotlin. The main goal is to practice UI Screenshot Testing.

KataScreenshot in Kotlin We are here to practice UI testing using screenshot tests for Android. We are going to use Espresso to interact with the Appl

Karumi 76 Nov 20, 2022
Super Heroes Kata for Android Developers in Kotlin. The main goal is to practice UI Testing.

KataSuperHeroes in Kotlin We are here to practice UI Testing. We are going to use Espresso to interact with the Application UI. We are going to use Ko

Karumi 86 Nov 20, 2022
KataContacts written in Kotlin. The main goal is to practice Clean Architecture Development

KataContacts written in Kotlin We are here to practice Clean Architecture Development. Clean Architecture is a way of structuring code. We are going t

Karumi 48 Oct 3, 2022
KTor-Client---Android - The essence of KTor Client for network calls

KTor Client - Android This project encompasses the essence of KTor Client for ne

Mansoor Nisar 2 Jan 18, 2022
🔥The Android Startup library provides a straightforward, performant way to initialize components at the application startup. Both library developers and app developers can use Android Startup to streamline startup sequences and explicitly set the order of initialization.

??The Android Startup library provides a straightforward, performant way to initialize components at the application startup. Both library developers and app developers can use Android Startup to streamline startup sequences and explicitly set the order of initialization.

Rouse 1.3k Dec 30, 2022
Multiplatform HTTP-Client implementation using Ktor

Kotlin Multiplatform HTTP-Client using Ktor Simple demonstration of a Ktor-based multiplatform HTTP-client in Kotlin Overview base submodule: common c

Jan Weidenhaupt 2 Oct 21, 2022
Mock up social media android application created to interact with a backend Java server using GraphQL.

The Community Board Project Authorship: author: dnglokpor date: may 2022 Project Summary: The Community Board Project consists of a Java Spring Boot b

Delwys Glokpor 1 May 17, 2022
Candroid does things different. The Candroid app store is a library of APK client wrappers (F-Droid, APKPure, etc.) For the main Candroid app store, try visiting the Candroid Market.

Candroid App Store Candroid does things different. The Candroid app store is a library of APK client wrappers (F-Droid, APKPure, etc.) For the main Ca

Sean P. Myrick V19.1.7.2 4 Dec 22, 2022