All Projects → rozkminiacz → Kotlinunittesting

rozkminiacz / Kotlinunittesting

Kotlin Unit Testing Examples

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Kotlinunittesting

BESTV
Android TV App powered by TMDb. It is a easy way to find the best TV content, the top movies, series... all of that in your TV.
Stars: ✭ 49 (-50.51%)
Mutual labels:  mockito, unit-test
TestIt
Generate unit testing boilerplate from kotlin files.
Stars: ✭ 32 (-67.68%)
Mutual labels:  mockito, unit-test
Android Mvp Architecture
🏛 A basic sample android application to understand MVP in a very simple way. Just clone, build, run and understand MVP.
Stars: ✭ 203 (+105.05%)
Mutual labels:  mockito, unit-test
Androidut
Android开发中必要的一环---单元测试(Unit Test)
Stars: ✭ 419 (+323.23%)
Mutual labels:  mockito, unit-test
Maven Examples
List of Maven examples
Stars: ✭ 79 (-20.2%)
Mutual labels:  unit-test
Mockstar
Demo project on How to be a Mockstar using Mockito and MockWebServer.
Stars: ✭ 53 (-46.46%)
Mutual labels:  mockito
Mvvm Kotlin Android Architecture
MVVM + Kotlin + Retrofit2 + Hilt + Coroutines + Kotlin Flow + mockK + Espresso + Junit5
Stars: ✭ 1,014 (+924.24%)
Mutual labels:  mockito
Star Wars Shop
Simple project with clean architecture and android lifecycle
Stars: ✭ 37 (-62.63%)
Mutual labels:  mockito
Cuckoo
Boilerplate-free mocking framework for Swift!
Stars: ✭ 1,344 (+1257.58%)
Mutual labels:  mockito
Clarity
A declaritive test framework for Terraform
Stars: ✭ 88 (-11.11%)
Mutual labels:  unit-test
Tcunit
An unit testing framework for Beckhoff's TwinCAT 3
Stars: ✭ 74 (-25.25%)
Mutual labels:  unit-test
Tdcapp
Sample app which access the TDC (The Developer's Conference) REST API.
Stars: ✭ 55 (-44.44%)
Mutual labels:  mockito
Newspaper
An aggregated newspaper app containing news from 10+ local news publishers in Hong Kong. Made with ❤
Stars: ✭ 82 (-17.17%)
Mutual labels:  mockito
Testify
A unit testing framework written in bash for bash scripts
Stars: ✭ 45 (-54.55%)
Mutual labels:  unit-test
Mvpandroid
Sample app to demonstrate MVP (Model - View - Presenter) architecture in android
Stars: ✭ 91 (-8.08%)
Mutual labels:  mockito
Weaponapp
一个尽量做到极致的集大成App,努力做到最好(开发阶段)——MVVM+Retrofit+RxJava+Small 插件化+单元测试+MD
Stars: ✭ 1,011 (+921.21%)
Mutual labels:  unit-test
Android App Architecture Mvvm Databinding
A simple but complete project (in both Java & Kotlin) to demonstrate the Android application architecture with MVVM pattern, a client app for The Movie DB Web API. Dagger2 is used for dependency injection and RxJava is used for RFP (Reactive Functional Programming).
Stars: ✭ 69 (-30.3%)
Mutual labels:  mockito
Ribot Android Boilerplate Kotlin
Kotlin version of android boilerplate app that showcases architecture and libraries used at ribot http://ribot.co.uk
Stars: ✭ 85 (-14.14%)
Mutual labels:  mockito
Daggermock
A JUnit rule to easily override Dagger 2 objects
Stars: ✭ 1,156 (+1067.68%)
Mutual labels:  mockito
Githubprojectbrowser
This is a sample Android Project that is based on Clean Architecture
Stars: ✭ 64 (-35.35%)
Mutual labels:  mockito

:gradle: 4.10.2 :junit: 4.12 :jupiter: 5.3.1 :kotlintest: 3.1.10 :mockk: 1.8.12 :spek: 2.0.0-rc.1 :mockito: 2.23.0 :strikt: 0.17.0 :mockito_kotlin: 2.0.0-RC1

:toc:

= Kotlin Unit Testing Examples https://github.com/rozkminiacz/KotlinUnitTesting v1.0, 2018-27-07 :imagesdir: assets/images :homepage: http://asciidoctor.org

This repository contains examples of basic unit tests written in Kotlin. In specific directories you can find gradle buildscript with needed dependencies and configuration, simple unit test and parameterized test.


All sample projects was verified under Gradle {gradle} and Intellij IDEA 2018.2.4


== Application

UseCase which provides empty string - to showcase structure of test methods

DistanceConverter - converts meters to kilometers in parameterized tests

MVP - Model-View-Presenter contract

== Gradle, Kotlin & Groovy

This Gradle project is by default configured with https://github.com/gradle/kotlin-dsl[Gradle's Kotlin DSL]

The equivalent Groovy build are still available for you copy&pasting pleasures, they have been renamed as build.gradle.groovy

You can switch between Groovy and Kotlin by running the script $ ./toggle-kotlin-groovy.sh

== Junit4

https://junit.org/junit4/

Attach to project

[source,groovy,subs="attributes+"]

dependencies{ testCompile group: 'junit', name: 'junit', version: '{junit}' }

== Junit5

https://junit.org/junit5/

Attach to project

[source,groovy,subs="attributes+"]

dependencies { testCompile('org.junit.jupiter:junit-jupiter-api:{jupiter}') testCompile('org.junit.jupiter:junit-jupiter-params:{jupiter}') testRuntime('org.junit.jupiter:junit-jupiter-engine:{jupiter}') }

test { useJUnitPlatform() testLogging { events "passed", "skipped", "failed" } }

== KotlinTest

https://github.com/kotlintest/kotlintest

Attach to project

[source,groovy,subs="attributes+"]

dependencies{ testCompile 'io.kotlintest:kotlintest-runner-junit5:{kotlintest}' }

== Spek

https://spekframework.org version 2.x

Attach to project

[source,groovy,subs="attributes+"]

repositories { mavenCentral() maven { url "https://dl.bintray.com/spekframework/spek-dev" }

}

test { useJUnitPlatform { includeEngines 'spek2' } }

dependencies { testImplementation ('org.spekframework.spek2:spek-dsl-jvm:{spek}') { exclude group: 'org.jetbrains.kotlin' } testRuntimeOnly ('org.spekframework.spek2:spek-runner-junit5:{spek}') { exclude group: 'org.junit.platform' exclude group: 'org.jetbrains.kotlin' }

testCompile('org.junit.jupiter:junit-jupiter-api:{jupiter}')


// spek requires kotlin-reflect, can be omitted if already in the classpath
testRuntimeOnly "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"

}


For Spek you may also need additional Intellij or Android Studio https://plugins.jetbrains.com/plugin/10915-spek-framework[plugin]


== Mockito

https://site.mockito.org

Add to project

[source,groovy,subs="attributes+"]

repositories { mavenCentral() jcenter() }

dependencies { testCompile "org.mockito:mockito-core:{mockito}"

testCompile group: 'junit', name: 'junit', version: '{junit}'

}

== Mockito-Kotlin

https://github.com/nhaarman/mockito-kotlin

Add to project

[source,groovy,subs="attributes+"]

repositories { mavenCentral() jcenter() }

dependencies { testCompile "org.mockito:mockito-core:{mockito}" testCompile "com.nhaarman.mockitokotlin2:mockito-kotlin:{mockito_kotlin}"

testCompile group: 'junit', name: 'junit', version: '{junit}'

}

== Mockk

https://github.com/mockk/mockk

Add to project

[source,groovy,subs="attributes+"]

dependencies { testCompile group: 'junit', name: 'junit', version: '{junit}' testImplementation "io.mockk:mockk:{mockk}" }

== Strikt

https://strikt.io

Add to project

[source,groovy,subs="attributes+"]

dependencies { testImplementation("io.strikt:strikt-core:{strikt}") }

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].