Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

サーバーサイド Kotlin のテストフレームワーク事情

226 views

Published on

Test frameworks in Server Side Kotlin.
Performed at https://love-kotlin.connpass.com/event/183232/ .

Comparison of JUnit/Spek/kotest.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

サーバーサイド Kotlin のテストフレームワーク事情

  1. 1. @mike_neck
  2. 2. • JUnit Platform • • https://github.com/mike-neck/test-frameworks
  3. 3. • Kotlin • JUnit Jupiter • Spek • kotest •
  4. 4. Kotlin
  5. 5. Kotlin
  6. 6. ( )
  7. 7. JUnit Jupiter • (junit) • JUnit4 • API( ) • Engine( ) • Platform( /IDE ) • JUnit Jupiter API Engine ( JUnit Vintage Engine )
  8. 8. JUnit Jupiter
  9. 9. JUnit Jupiter • (+) Kotlin Java • (+) ( Phase ) • (+) Spring • (+) assertAll/Executable/assertThrows Java Kotlin extension function • (-)
  10. 10. • Specification Framework ( ) • 2017 version 1 version 2 • specification gherkin 2 ( 3 )
  11. 11. • (+) JUnit Java JUnit Specification/Gherkin • (+) memoized ReadOnlyProperty Discovery • (-) Spring • (-) Gradle
  12. 12. • kotlintest • • 10 API +
  13. 13. • (+) • (+) • (+) Spring Framework/Micronaut Framework • (-) • (-) Gradle
  14. 14. Specification class MisleadingSpec: FunSpec({ val list = mutableList<String>() context("add an element to empty list") { list.add("foo") test("size is 1") { list shouldHaveSize 1 } } list.add("bar") context("no operation on a list(2)") { test("size is 2") { list shouldHaveSize 2 } }
  15. 15. Specification class MisleadingSpec: FunSpec({ val list = mutableList<String>() context("add an element to empty list") { list.add("foo") test("size is 1") { list shouldHaveSize 1 } } list.add("bar") context("no operation on a list(2)") { test("size is 2") { list shouldHaveSize 2 } }
  16. 16. Specification class MisleadingSpec: FunSpec({ val list = mutableList<String>() context("add an element to empty list") { list.add("foo") test("size is 1") { list shouldHaveSize 1 } } list.add("bar") context("no operation on a list(2)") { test("size is 2") { list shouldHaveSize 2 } }
  17. 17. Specification val list by memoized { mutableList<Any>() } configuration Phase ( ) isolationMode = IsolationMode.InstancePerTest context/given/describe
  18. 18. kotest
  19. 19. kotest
  20. 20. kotest • • JUnit Platform
  21. 21. • kotest / Spek / JUnit • Kotlin/Java • Specification • kotest
  22. 22. Specification
  23. 23. mike-neck/ktcheck • JUnit Platform • Given/When/Then • implementation 'run.ktcheck:ktcheck:v0.1.0'

×