icerockdev / moko-widgets

Multiplatform UI DSL with screen management in common code for mobile (android & ios) Kotlin Multiplatform development
https://moko.icerock.dev
Apache License 2.0
384 stars 31 forks source link

Introduce Unit Testing for moko-widgets #213

Open Gamadril opened 4 years ago

Gamadril commented 4 years ago

Just an idea to improve/keep code quality level.

Alex009 commented 4 years ago

maybe you can show some sample how you see it? or reference

Gamadril commented 4 years ago

I'm quite new to kotlin and cannot tell much about the best way to do it. However I found that article quite informative: https://phauer.com/2018/best-practices-unit-testing-kotlin/ In general it should work like unit testing in any other language - at the end you want to test the functionality of the own code. Here is how it could look like - a small project I quickly made for MarginValues from the https://github.com/junit-team/junit5-samples/tree/master/junit5-jupiter-starter-gradle-kotlin template and gradle documentation.

KotlinUnitTesting.zip