Maxibon kata for Kotlin Developers. The main goal is to practice property based testing.

Overview

Karumi logo Kata Maxibon for Kotlin. Build Status

During this kata we will try to find how to use property based testing from different points of view:

  • Using property based testing and TDD at the same time.
  • Using property based testing to cover legacy code.
  • Using the already tested code to check if the tests are working fine (manual mutation testing).

If you want to learn just property based testing using an already implemented application go to the branch write-tests. If you prefer to practice TDD in the master branch you will find the kata already resolved. If you prefer to practice mutation testing stay in the master branch.

Getting started

Karumi developers love ice cream. And one of our favorites ice cream is named Maxibon:

Maxibon

Summer is comming and our small team sometime needs Maxibons to work better. But in the Karumi HQs finding a Maxibon is not always easy. We start every week with 10 Maxibons but once there are just 2 Maxibons or less we need to buy more.

Karumi developers can consume zero or a positive number of maxibons. The Karumi team is composed by five engineers and everytime some of these engineers go to the kitchen they grab some maxibons as follows:

  • If the developer is Pedro, he grabs three maxibons.
  • If the developer is Fran, he grabs one maxibon.
  • If the developer is Davide, he does not grab any maxibon.
  • If the developer is Sergio, he grabs two maxibons.
  • If the developer is Jorge, he grabs one maxibon.

When a Karumi engineer goes to the kitchen, they can go in group if needed, and there are just 2 maxibons or less left he has to send a message through the Slack API saying "Hi guys, I'm <NAME OF THE DEVELOPER>. We need more maxibons!". And the number of maxibons available will be automatically incremented by 10 :). If the number of maxibons left is lower than the number of maxibons the developer tries to get he will get just the number of maxibons available.

Tasks

Your task as iOS Developer is to resolve this problem or test an already implemented software, depending on the path you have choosen before to start.

  • If you want to practice TDD write a little piece of software to implement the already described scenario following the TDD cycle.
  • If you don not want to follow the TDD path create an empty project, add Kotlin Test as a dependency and start writing code.
  • If you prefer to just learn how to use property based testing you can use this repository just checkout to the branch write-tests.

Extra tasks:

  • Change the initial number of maxibons to be configurable.
  • Add the verbose modifier to the properties to review if the generation is working fine.
  • Change your production code to check if your tests fail or not.
  • Configure the number of generations used per property.

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

License

Copyright 2017 Karumi

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...
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

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 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

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

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.

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

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

An library to help android developers working easly with activities and fragments (Kotlin version)
An library to help android developers working easly with activities and fragments (Kotlin version)

AFM An library to help android developer working easly with activities and fragments (Kotlin) Motivation Accelerate the process and abstract the logic

A pragmatic lightweight dependency injection framework for Kotlin developers.
A pragmatic lightweight dependency injection framework for Kotlin developers.

A pragmatic lightweight dependency injection framework for Kotlin developers. Koin is a DSL, a light container and a pragmatic API

Comments
  • Implementation

    Implementation

    :tophat: What is the goal?

    Port this kata from Java and Swift to Kotlin πŸ˜ƒ

    How is it being implemented?

    The steps followed to implement this kata are:

    • Create an empty repository with the following configuration and push it directly to master so we can discuss better about the kata implementation:
      • Project README.md.
      • Empty Kotlin project using Gradle as build tool.
      • License and contributing file.
      • Ktlint configuration.
      • Travis configuration.
    • Add the dependencies needed to the project, in this case we've used io.kotlintest:kotlintest:2.0.7 instead of JUnit because it directly supports property-based testing as you can read in the project documentation page.
    • Choose the spec style we are going to use. As part of the team is using a "should like" spec in Scala I've decided to use this one.
    • Write the production code. Pay special attention to the constructor of our Developoer class.
    • Write the specs. **Pay special attention to the usage of generators objects as a namespace, the generators implementation and the usage of Kotlin Test which could not be familiar to you if you are a JUnit developer.

    How can it be tested?

    Let Travis CI test this for you πŸ˜ƒ

    When reviewing this PR, remember that it's used during our training lessons and part of the code can be intentionally written as is.

    opened by pedrovgs 3
  • Update master branch dependencies

    Update master branch dependencies

    :tophat: What is the goal?

    To update the repository to use the latest versions of gradle, kotlin and kotlintest

    :hammer_and_wrench: How is it being implemented?

    • Update dependencies
    • Update how generators are created to match the new kotlintest API. More specifically the Gen interface now expects two methods to be implemented: random and constants. The former is equivalent to the good old generate function but returning a sequence of items, not a single element. The constants function is used to return edge cases that should be always tested. I opted to leave that empty out of laziness.

    How can it be tested?

    ./gradlew test

    opened by Serchinastico 0
  • Initial code improvements

    Initial code improvements

    :pushpin: References

    • Issue:
    • Related pull-requests: #1

    :tophat: What is the goal?

    Address my comments for the first PR

    :hammer_and_wrench: How is it being implemented?

    • Extract magic numbers to constants.
    • Parameterize test to avoid a for inside the test. I think it's more didactic and we'll avoid masking errors in case of failure
    • Add bounded list generator. It can be as an example of generic generators.
    • Add tests to ensure the correct behavior of the chat when grabbing maxibons in group.

    How can it be tested?

    Let CI do it for you ;)

    opened by delr3ves 0
Owner
Karumi
Karumi, the Rock Solid Code studio
Karumi
TODO API Client Kata for Kotlin Developers. The main goal is to practice integration testing using MockWebServer

KataTODOApiClient for Kotlin We are here to practice integration testsing using HTTP stubbing. We are going to use MockWebServer to simulate a HTTP se

Karumi 61 Nov 20, 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
πŸ”₯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
Example project for using the Selenium toolkit with Kotlin, Maven, TestNg and the config is managed via a property file.

Selenium-Java-Toolkit-TestNg-Playground This is the sample-Project and show you how to use the Selenium-Toolkit. The Selenium-Toolkit is a Java based

Selenium Consulting 0 Dec 15, 2021
Kotlin compiler plugin that allows class delegation to be dynamic like property delegations

kotlin-dynamic-delegation Kotlin compiler plugin that allows class delegation to be dynamic like property delegations. The plugin is working in progre

Him188 14 Sep 8, 2022
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

Breens Mbaka 12 Jul 7, 2022
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

null 1 Nov 22, 2021