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

Related tags

App training
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...
Proyect with the goal to show my skills in android
Proyect with the goal to show my skills in android

ChipperMovie Es una aplicación de peliculas y sus detalles filtrados por categorias para demostrar el uso de mis habilidaedes en desarrollo movil. Ace

The goal of this assignment is to implement GameOfFifteen
The goal of this assignment is to implement GameOfFifteen

Game of Fifteen Demo The board for the game of Fifteen is filled randomly with numbers from 1 to 15 and one empty space. You can move the neighboring

GOD - Goal of the day is the notes app which tracks your daily tasks, most important tasks & monthly goals
GOD - Goal of the day is the notes app which tracks your daily tasks, most important tasks & monthly goals

GOD - Goal of the day GOD - Goals of the day Problem Statement: People always face problems in finding their goals and keeping track over a period. Th

App consist of 4 main fragments accessable from bottom navigation
App consist of 4 main fragments accessable from bottom navigation

Bug demo Demo App consist of 4 main fragments accessable from bottom navigation, each fragment is a tablayout hosting 2 more child fragment, child fra

Cryptac is a mobile application that allows you to track the main important information about your favorite cryptos
Cryptac is a mobile application that allows you to track the main important information about your favorite cryptos

Cryptac is a mobile application that allows you to track the main important information about your favorite cryptos.

Smart-flight - This app was created to learn and practice Kotlin language
Smart-flight - This app was created to learn and practice Kotlin language

Smart Flight This app was created to learn and practice Kotlin language. Works o

practice with Refactoring2.0 written by Martin Fowler

practice-with-Refactoring2.0 practice with Refactoring2.0 written by Martin Fowler Chap 1. 첫번째 예시 리팩터링 2판의 예시는 자바스크립트로 이뤄져있다. 코틀린에 익숙해지기 위해 코틀린으로 코드를

Android practice shared ViewModel

Cupcake app This app contains an order flow for cupcakes with options for quantity, flavor, and pickup date. The order details get displayed on an ord

Android Practice (1sem)

Lab6) 1.Залил 3 простых экрана заставка регистрация авторизация профиль Lab7) Изменил в прошлых экранах некоторые поля EditText с квадратного на кругл

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
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
Kata to practice Clean Architecture & MVI by building TodoList Application

Mvi Todo Kata Application Features TODO specification Title Description Due Date Priority Supported Operations Create a new TODO Remove a TODO Select

seungmin shin 0 Nov 3, 2021
MVVM + Kotlin + Jetpack Compose +Navigation Compose + Hilt + Retrofit + Unit Testing + Compose Testing + Coroutines + Kotlin Flow + Io mockK

MvvmKotlinJetpackCompose Why do we need an architecture even when you can make an app without it? let's say you created a project without any architec

Sayyed Rizwan 46 Nov 29, 2022
Registration validation testing, Room database testing using JUnit4

Notes app Registration details validation testing, Room database testing using JUnit4 ✨ Screenshots Authors Tridev Deka - LinkedIn - Tridev Deka MIT L

Tridev Deka 0 Mar 30, 2022
A console-based productivity app involving both To-Do Lists and Goal tracking

This is a console-based productivity app involving both To-Do Lists and Goal tracking. It allows users to create To-Dos, check them off, and filter the display between complete/incomplete items

Joel Jossie 3 Dec 25, 2022
Transport Tycoon Kata

Transport Tycoon Kata This is a kata proposed by SoftwarePark. You can find the original one here I modified some parts of it, to make it different, m

Albert Casanovas 0 Aug 30, 2022
Cody Engel 2 Apr 20, 2022
A reliable android app that shows upcoming fixtures, updated league tables, and top goal scorers in a Premier League and French Ligue 1

RapidScore Screenshots Table of Contents Description Dependencies API Reference Lessons Learnt Contributing Roadmap Google Playstore License Author In

Breens Mbaka 12 Jul 7, 2022