Skip to content
Permalink
Browse files

Feature/composespecs2 (#1144)

* Reusable composable specs

* Reusable composable specs

* Reusable composable specs

* Reusable composable specs

* Reusable composable specs

* Reusable composable specs

* Added readme

* Added readme

* composable specs

* Reusable composable specs

* Reusable composable specs

* composable specs

* composable specs

* Reusable composable specs

* dep upgrades

* dep upgrades

* Some fp updates

* Some fp updates

* Reusable composable specs

* Reusable composable specs

* Reusable composable specs

* Reusable composable specs

* Reusable composable specs

* Reusable composable specs

* Reusable composable specs

* Reusable composable specs

* Reusable composable specs
  • Loading branch information
sksamuel committed Jan 12, 2020
1 parent 0d556b6 commit f7f8b0ee52655f9238f68af4b47aefe354a37cd4
Showing with 10,533 additions and 9,039 deletions.
  1. +9 −0 buildSrc/build.gradle.kts
  2. +50 −0 buildSrc/src/main/kotlin/Libs.kt
  3. +5 −0 buildSrc/src/main/kotlin/Travis.kt
  4. +160 −0 composable_specs.md
  5. +0 −1 gradle.properties
  6. +6 −9 kotest-assertions/build.gradle.kts
  7. +6 −5 kotest-assertions/src/jvmTest/kotlin/com/sksamuel/kotest/assertions/AssertionCounterTest.kt
  8. +191 −191 kotest-assertions/src/jvmTest/kotlin/com/sksamuel/kotest/data/DataDrivenTestingTest.kt
  9. +1,257 −1,257 kotest-assertions/src/jvmTest/kotlin/com/sksamuel/kotest/matchers/doubles/DoubleMatchersTest.kt
  10. +41 −41 kotest-assertions/src/jvmTest/kotlin/com/sksamuel/kotest/properties/ClassifyTest.kt
  11. +72 −72 kotest-assertions/src/jvmTest/kotlin/com/sksamuel/kotest/properties/GenBindTest.kt
  12. +23 −23 kotest-assertions/src/jvmTest/kotlin/com/sksamuel/kotest/properties/GenSeedTest.kt
  13. +676 −676 kotest-assertions/src/jvmTest/kotlin/com/sksamuel/kotest/properties/GenTest.kt
  14. +170 −169 kotest-assertions/src/jvmTest/kotlin/com/sksamuel/kotest/properties/PropertyAssertAllOutputTest.kt
  15. +487 −487 kotest-assertions/src/jvmTest/kotlin/com/sksamuel/kotest/properties/PropertyAssertAllTest.kt
  16. +453 −453 kotest-assertions/src/jvmTest/kotlin/com/sksamuel/kotest/properties/PropertyForAllTest.kt
  17. +597 −597 kotest-assertions/src/jvmTest/kotlin/com/sksamuel/kotest/properties/PropertyForNoneTest.kt
  18. +33 −33 kotest-assertions/src/jvmTest/kotlin/com/sksamuel/kotest/properties/StringGenTest.kt
  19. +46 −42 kotest-assertions/src/jvmTest/kotlin/com/sksamuel/kotest/properties/shrinking/ChooseShrinkerTest.kt
  20. +48 −44 kotest-assertions/src/jvmTest/kotlin/com/sksamuel/kotest/properties/shrinking/IntShrinkerTest.kt
  21. +34 −30 kotest-assertions/src/jvmTest/kotlin/com/sksamuel/kotest/properties/shrinking/ListShrinkerTest.kt
  22. +122 −122 kotest-assertions/src/jvmTest/kotlin/com/sksamuel/kotest/properties/shrinking/ShrinkTest.kt
  23. +69 −69 kotest-assertions/src/jvmTest/kotlin/com/sksamuel/kotest/properties/shrinking/StringShrinkerTest.kt
  24. +0 −18 kotest-assertions/src/jvmTest/resources/log4j.xml
  25. +6 −5 kotest-core/build.gradle.kts
  26. +0 −7 kotest-core/src/commonMain/kotlin/io/kotest/AssertionMode.kt
  27. +0 −71 kotest-core/src/commonMain/kotlin/io/kotest/Description.kt
  28. +6 −13 kotest-core/src/commonMain/kotlin/io/kotest/{Spec.kt → SpecClass.kt}
  29. +0 −66 kotest-core/src/commonMain/kotlin/io/kotest/TestCase.kt
  30. +0 −5 kotest-core/src/commonMain/kotlin/io/kotest/TestCaseOrder.kt
  31. +24 −0 kotest-core/src/commonMain/kotlin/io/kotest/core/AssertionMode.kt
  32. +84 −0 kotest-core/src/commonMain/kotlin/io/kotest/core/Description.kt
  33. +2 −2 kotest-core/src/commonMain/kotlin/io/kotest/{ → core}/IsolationMode.kt
  34. +19 −0 kotest-core/src/commonMain/kotlin/io/kotest/core/ProjectConfiguration.kt
  35. +1 −1 kotest-core/src/commonMain/kotlin/io/kotest/{ → core}/SkipTestException.kt
  36. +26 −0 kotest-core/src/commonMain/kotlin/io/kotest/core/SpecExecutionOrder.kt
  37. +3 −2 kotest-core/src/commonMain/kotlin/io/kotest/{ → core}/Tag.kt
  38. +8 −5 kotest-core/src/commonMain/kotlin/io/kotest/{ → core}/Tags.kt
  39. +100 −0 kotest-core/src/commonMain/kotlin/io/kotest/core/TestCase.kt
  40. +24 −8 kotest-core/src/commonMain/kotlin/io/kotest/core/TestCaseConfig.kt
  41. +0 −3 kotest-core/src/commonMain/kotlin/io/kotest/core/TestCaseFilter.kt
  42. +10 −0 kotest-core/src/commonMain/kotlin/io/kotest/core/TestCaseOrder.kt
  43. +52 −30 kotest-core/src/commonMain/kotlin/io/kotest/core/TestContext.kt
  44. +31 −6 kotest-core/src/commonMain/kotlin/io/kotest/{ → core}/TestResult.kt
  45. +1 −1 kotest-core/src/commonMain/kotlin/io/kotest/{ → core}/TestType.kt
  46. +10 −16 kotest-core/src/{jvmMain/kotlin/io/kotest/internal → commonMain/kotlin/io/kotest/core}/active.kt
  47. +24 −0 kotest-core/src/commonMain/kotlin/io/kotest/core/classutils.kt
  48. +0 −7 kotest-core/src/commonMain/kotlin/io/kotest/core/description.kt
  49. +19 −0 kotest-core/src/commonMain/kotlin/io/kotest/core/descriptions.kt
  50. +22 −0 kotest-core/src/commonMain/kotlin/io/kotest/core/focusbang.kt
  51. +7 −0 kotest-core/src/commonMain/kotlin/io/kotest/core/spec/CompositeSpec.kt
  52. +337 −0 kotest-core/src/commonMain/kotlin/io/kotest/core/spec/TestFactoryConfiguration.kt
  53. +95 −0 kotest-core/src/commonMain/kotlin/io/kotest/core/spec/compatibility.kt
  54. +17 −0 kotest-core/src/commonMain/kotlin/io/kotest/core/spec/dsl.kt
  55. +46 −0 kotest-core/src/commonMain/kotlin/io/kotest/core/spec/examples.kt
  56. +105 −0 kotest-core/src/commonMain/kotlin/io/kotest/core/spec/funSpec.kt
  57. +62 −0 kotest-core/src/commonMain/kotlin/io/kotest/core/spec/stringSpec.kt
  58. +9 −9 kotest-core/src/commonMain/kotlin/io/kotest/core/specs/AbstractDescribeSpec.kt
  59. +2 −2 kotest-core/src/commonMain/kotlin/io/kotest/core/specs/AbstractExpectSpec.kt
  60. +2 −2 kotest-core/src/commonMain/kotlin/io/kotest/core/specs/AbstractFeatureSpec.kt
  61. +2 −2 kotest-core/src/commonMain/kotlin/io/kotest/core/specs/AbstractFreeSpec.kt
  62. +2 −2 kotest-core/src/commonMain/kotlin/io/kotest/core/specs/AbstractShouldSpec.kt
  63. +25 −23 kotest-core/src/commonMain/kotlin/io/kotest/core/specs/AbstractSpec.kt
  64. +6 −54 kotest-core/src/commonMain/kotlin/io/kotest/core/specs/AbstractSpecDsl.kt
  65. +102 −79 kotest-core/src/commonMain/kotlin/io/kotest/core/specs/AbstractWordSpec.kt
  66. +23 −27 kotest-core/src/commonMain/kotlin/io/kotest/core/specs/SuiteSpec.kt
  67. +5 −0 kotest-core/src/commonMain/kotlin/io/kotest/core/sysprop.kt
  68. +3 −5 kotest-core/src/commonMain/kotlin/io/kotest/extensions/Extension.kt
  69. +2 −2 kotest-core/src/commonMain/kotlin/io/kotest/extensions/TagExtension.kt
  70. +2 −2 kotest-core/src/commonMain/kotlin/io/kotest/extensions/TestCaseExtension.kt
  71. +28 −28 kotest-core/src/commonMain/kotlin/io/kotest/extensions/TestListener.kt
  72. +2 −2 kotest-core/src/commonMain/kotlin/io/kotest/specs/BehaviorSpec.kt
  73. +2 −61 kotest-core/src/commonMain/kotlin/io/kotest/specs/FunSpec.kt
  74. +5 −36 kotest-core/src/commonMain/kotlin/io/kotest/specs/StringSpec.kt
  75. +0 −8 kotest-core/src/jsMain/kotlin/io/kotest/core/description.kt
  76. +7 −0 kotest-core/src/jsMain/kotlin/io/kotest/core/fqn.kt
  77. +3 −3 kotest-core/src/jsMain/kotlin/io/kotest/core/specs/markers.kt
  78. +5 −0 kotest-core/src/jsMain/kotlin/io/kotest/core/sysprop.kt
  79. +8 −0 kotest-core/src/jsMain/kotlin/io/kotest/core/tagExtensions.kt
  80. +0 −3 kotest-core/src/jsMain/kotlin/io/kotest/resolvedAssertionMode.kt
  81. +7 −5 kotest-core/src/jvmMain/kotlin/io/kotest/AbstractProjectConfig.kt
  82. +1 −3 kotest-core/src/jvmMain/kotlin/io/kotest/AbstractSpec.kt
  83. +4 −3 kotest-core/src/jvmMain/kotlin/io/kotest/Project.kt
  84. +0 −24 kotest-core/src/jvmMain/kotlin/io/kotest/SpecExecutionOrder.kt
  85. +0 −5 kotest-core/src/jvmMain/kotlin/io/kotest/TestCaseContext.kt
  86. +3 −2 kotest-core/src/jvmMain/kotlin/io/kotest/{ → core}/FailureFirstSpecExecutionOrder.kt
  87. +0 −7 kotest-core/src/jvmMain/kotlin/io/kotest/core/description.kt
  88. +19 −0 kotest-core/src/jvmMain/kotlin/io/kotest/core/fqn.kt
  89. +1 −1 kotest-core/src/jvmMain/kotlin/io/kotest/core/specs/markers.kt
  90. +6 −0 kotest-core/src/jvmMain/kotlin/io/kotest/core/sysprop.kt
  91. +9 −0 kotest-core/src/jvmMain/kotlin/io/kotest/core/tagExtensions.kt
  92. +0 −35 kotest-core/src/jvmMain/kotlin/io/kotest/displayName.kt
  93. +21 −18 kotest-core/src/jvmMain/kotlin/io/kotest/extensions/ConstructorExtension.kt
  94. +20 −21 kotest-core/src/jvmMain/kotlin/io/kotest/extensions/DiscoveryExtension.kt
  95. +19 −19 kotest-core/src/jvmMain/kotlin/io/kotest/extensions/SpecExtension.kt
  96. +8 −4 kotest-core/src/jvmMain/kotlin/io/kotest/extensions/SystemPropertyTagExtension.kt
  97. +0 −25 kotest-core/src/jvmMain/kotlin/io/kotest/internal/topLevelTests.kt
  98. +19 −0 kotest-core/src/jvmMain/kotlin/io/kotest/listenerinstances.kt
  99. +0 −6 kotest-core/src/jvmMain/kotlin/io/kotest/resolvedAssertionMode.kt
  100. +235 −236 kotest-core/src/jvmMain/kotlin/io/kotest/specs/AbstractAnnotationSpec.kt
  101. +0 −1 kotest-core/src/jvmMain/resources/log4j.properties
  102. +57 −54 ...nsions/kotest-extensions-allure/src/jvmMain/kotlin/io/kotest/extensions/allure/AllureExtension.kt
  103. +0 −18 kotest-extensions/kotest-extensions-allure/src/jvmTest/resources/log4j.xml
  104. +3 −3 kotest-extensions/kotest-extensions-koin/src/jvmMain/kotlin/io/kotest/koin/KoinListener.kt
  105. +5 −5 ...t-extensions/kotest-extensions-koin/src/jvmTest/kotlin/com/sksamuel/kt/koin/KotlinListenerTest.kt
  106. +7 −7 ...ensions-robolectric/src/jvmMain/kotlin/io/kotest/experimental/robolectric/RobolectricExtension.kt
  107. +11 −11 kotest-extensions/kotest-extensions-spring/src/jvmMain/kotlin/io/kotest/spring/SpringListener.kt
  108. +5 −5 ...st-extensions-spring/src/jvmTest/kotlin/com/sksamuel/kt/spring/SpringTestExecutionListenerTest.kt
  109. +11 −11 kotest-extensions/src/jvmMain/kotlin/io/kotest/extensions/locale/LocaleExtensions.kt
  110. +11 −11 kotest-extensions/src/jvmMain/kotlin/io/kotest/extensions/locale/TimezoneExtensions.kt
  111. +35 −35 kotest-extensions/src/jvmMain/kotlin/io/kotest/extensions/system/NoSystemOutExtensions.kt
  112. +11 −11 kotest-extensions/src/jvmMain/kotlin/io/kotest/extensions/system/SecurityManagerExtensions.kt
  113. +4 −4 kotest-extensions/src/jvmMain/kotlin/io/kotest/extensions/system/SystemEnvironmentExtensions.kt
  114. +43 −41 kotest-extensions/src/jvmMain/kotlin/io/kotest/extensions/system/SystemExitExtensions.kt
  115. +2 −2 kotest-extensions/src/jvmMain/kotlin/io/kotest/extensions/system/SystemPropertiesExtensions.kt
  116. +2 −2 kotest-extensions/src/jvmMain/kotlin/io/kotest/extensions/system/wireListeners.kt
  117. +10 −9 kotest-extensions/src/jvmMain/kotlin/io/kotest/extensions/time/ConstantNowExtensions.kt
  118. +6 −5 kotest-extensions/src/jvmTest/kotlin/com/sksamuel/kt/extensions/locale/LocaleExtensionTest.kt
  119. +5 −5 kotest-extensions/src/jvmTest/kotlin/com/sksamuel/kt/extensions/locale/TimeZoneListenerTest.kt
  120. +2 −2 ...extensions/src/jvmTest/kotlin/com/sksamuel/kt/extensions/system/SecurityManagerExtensionsTests.kt
  121. +5 −5 ...extensions/src/jvmTest/kotlin/com/sksamuel/kt/extensions/system/SystemEnvironmentExtensionTest.kt
  122. +5 −5 ...xtensions/src/jvmTest/kotlin/com/sksamuel/kt/extensions/system/SystemPropertiesExtensionsTests.kt
  123. +4 −4 kotest-extensions/src/jvmTest/kotlin/com/sksamuel/kt/extensions/time/ConstantNowExtensionsTests.kt
  124. +0 −18 kotest-extensions/src/jvmTest/resources/log4j.xml
  125. +66 −0 kotest-fp/build.gradle.kts
  126. +41 −0 kotest-fp/src/commonMain/kotlin/io/kotest/fp/Option.kt
  127. +48 −0 kotest-fp/src/commonMain/kotlin/io/kotest/fp/Try.kt
  128. +3 −0 kotest-fp/src/jsMain/kotlin/io/kotest/fp/nonFatal.kt
  129. +6 −0 kotest-fp/src/jvmMain/kotlin/io/kotest/fp/nonFatal.kt
  130. +27 −27 kotest-plugins/kotest-plugins-pitest/src/jvmMain/kotlin/io/kotest/plugin/pitest/KotestUnit.kt
  131. +8 −7 kotest-plugins/kotest-plugins-pitest/src/jvmMain/kotlin/io/kotest/plugin/pitest/KotestUnitFinder.kt
  132. +6 −6 kotest-plugins/kotest-plugins-pitest/src/jvmTest/kotlin/io/kotest/provided/ProjectConfig.kt
  133. +7 −7 ...st-runner/kotest-runner-console/src/jvmMain/kotlin/io/kotest/runner/console/BasicConsoleWriter.kt
  134. +4 −4 ...t-runner/kotest-runner-console/src/jvmMain/kotlin/io/kotest/runner/console/KotestConsoleRunner.kt
  135. +9 −9 ...st-runner/kotest-runner-console/src/jvmMain/kotlin/io/kotest/runner/console/MochaConsoleWriter.kt
  136. +4 −4 ...t-runner/kotest-runner-console/src/jvmMain/kotlin/io/kotest/runner/console/SpecAwareTestFilter.kt
  137. +2 −2 kotest-runner/kotest-runner-console/src/jvmMain/kotlin/io/kotest/runner/console/StyleParser.kt
  138. +8 −8 ...runner/kotest-runner-console/src/jvmMain/kotlin/io/kotest/runner/console/TeamCityConsoleWriter.kt
  139. +12 −4 kotest-runner/kotest-runner-console/src/jvmMain/kotlin/io/kotest/runner/console/launcher.kt
  140. +2 −2 ...st-runner-console/src/jvmTest/kotlin/com/sksamuel/kotest/runner/console/BasicConsoleWriterTest.kt
  141. +9 −5 ...nner-console/src/jvmTest/kotlin/com/sksamuel/kotest/runner/console/BehaviorSpecStyleParserTest.kt
  142. +5 −3 ...nner-console/src/jvmTest/kotlin/com/sksamuel/kotest/runner/console/DelimitedTestPathParserTest.kt
  143. +7 −4 ...nner-console/src/jvmTest/kotlin/com/sksamuel/kotest/runner/console/DescribeSpecStyleParserTest.kt
  144. +9 −5 ...runner-console/src/jvmTest/kotlin/com/sksamuel/kotest/runner/console/ExpectSpecStyleParserTest.kt
  145. +5 −3 ...unner-console/src/jvmTest/kotlin/com/sksamuel/kotest/runner/console/FeatureSpecStyleParserTest.kt
  146. +1 −1 ...st-runner-console/src/jvmTest/kotlin/com/sksamuel/kotest/runner/console/FunSpecStyleParserTest.kt
  147. +5 −3 ...runner-console/src/jvmTest/kotlin/com/sksamuel/kotest/runner/console/ShouldSpecStyleParserTest.kt
  148. +192 −192 ...t-runner-console/src/jvmTest/kotlin/com/sksamuel/kotest/runner/console/SpecAwareTestFilterTest.kt
  149. +1 −1 ...runner-console/src/jvmTest/kotlin/com/sksamuel/kotest/runner/console/StringSpecStyleParserTest.kt
  150. +129 −124 ...runner-console/src/jvmTest/kotlin/com/sksamuel/kotest/runner/console/TeamCityConsoleWriterTest.kt
  151. +3 −2 ...t-runner-console/src/jvmTest/kotlin/com/sksamuel/kotest/runner/console/WordSpecStyleParserTest.kt
  152. +36 −13 kotest-runner/kotest-runner-junit5/build.gradle.kts
  153. +33 −0 ...nner/kotest-runner-junit5/src/jvmMain/kotlin/io/kotest/runner/junit5/ClassMethodAdaptingFilter.kt
  154. +170 −218 ...runner/kotest-runner-junit5/src/jvmMain/kotlin/io/kotest/runner/junit5/JUnitTestRunnerListener.kt
  155. +0 −115 kotest-runner/kotest-runner-junit5/src/jvmMain/kotlin/io/kotest/runner/junit5/KotestEngine.kt
  156. +86 −0 .../kotest-runner-junit5/src/jvmMain/kotlin/io/kotest/runner/junit5/KotestJunitPlatformTestEngine.kt
  157. +24 −10 kotest-runner/kotest-runner-junit5/src/jvmMain/kotlin/io/kotest/runner/junit5/discoveryRequest.kt
  158. +1 −1 ...kotest-runner-junit5/src/jvmMain/resources/META-INF/services/org.junit.platform.engine.TestEngine
  159. +75 −0 ...runner-junit5/src/jvmTest/kotlin/com/sksamuel/kotest/runner/junit5/JUnitTestRunnerListenerTest.kt
  160. +13 −0 kotest-runner/kotest-runner-junit5/src/jvmTest/resources/logback.xml
  161. +4 −4 kotest-runner/kotest-runner-jvm/build.gradle.kts
  162. +38 −0 kotest-runner/kotest-runner-jvm/src/jvmMain/kotlin/io/kotest/runner/jvm/Asserter.kt
  163. +0 −9 kotest-runner/kotest-runner-jvm/src/jvmMain/kotlin/io/kotest/runner/jvm/DiscoveryResult.kt
  164. +100 −106 ...t-runner/kotest-runner-jvm/src/jvmMain/kotlin/io/kotest/runner/jvm/IsolationTestEngineListener.kt
  165. +138 −0 kotest-runner/kotest-runner-jvm/src/jvmMain/kotlin/io/kotest/runner/jvm/KotestEngine.kt
  166. +3 −3 kotest-runner/kotest-runner-jvm/src/jvmMain/kotlin/io/kotest/runner/jvm/SpecFilter.kt
  167. +0 −248 kotest-runner/kotest-runner-jvm/src/jvmMain/kotlin/io/kotest/runner/jvm/TestCaseExecutor.kt
  168. +86 −91 kotest-runner/kotest-runner-jvm/src/jvmMain/kotlin/io/kotest/runner/jvm/TestDiscovery.kt
  169. +0 −132 kotest-runner/kotest-runner-jvm/src/jvmMain/kotlin/io/kotest/runner/jvm/TestEngine.kt
  170. +57 −77 kotest-runner/kotest-runner-jvm/src/jvmMain/kotlin/io/kotest/runner/jvm/TestEngineListener.kt
  171. +185 −0 kotest-runner/kotest-runner-jvm/src/jvmMain/kotlin/io/kotest/runner/jvm/TestExecutor.kt
  172. +10 −4 ...t-runner/kotest-runner-jvm/src/jvmMain/kotlin/io/kotest/runner/jvm/internal/NamedThreadFactory.kt
  173. +4 −4 kotest-runner/kotest-runner-jvm/src/jvmMain/kotlin/io/kotest/runner/jvm/jvm.kt
  174. +169 −169 ...unner/kotest-runner-jvm/src/jvmMain/kotlin/io/kotest/runner/jvm/spec/InstancePerLeafSpecRunner.kt
  175. +157 −157 ...unner/kotest-runner-jvm/src/jvmMain/kotlin/io/kotest/runner/jvm/spec/InstancePerTestSpecRunner.kt
  176. +50 −48 ...runner/kotest-runner-jvm/src/jvmMain/kotlin/io/kotest/runner/jvm/spec/SingleInstanceSpecRunner.kt
  177. +118 −95 kotest-runner/kotest-runner-jvm/src/jvmMain/kotlin/io/kotest/runner/jvm/spec/SpecExecutor.kt
  178. +100 −0 kotest-runner/kotest-runner-jvm/src/jvmMain/kotlin/io/kotest/runner/jvm/spec/SpecExecutor2.kt
  179. +44 −38 kotest-runner/kotest-runner-jvm/src/jvmMain/kotlin/io/kotest/runner/jvm/spec/SpecRunner.kt
  180. +38 −0 kotest-runner/kotest-runner-jvm/src/jvmMain/kotlin/io/kotest/runner/jvm/spec/materialize.kt
  181. +16 −18 kotest-tests/kotest-tests-core/build.gradle.kts
  182. +2 −2 kotest-tests/kotest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/BeforeTestThreadsTest.kt
  183. +1 −1 kotest-tests/kotest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/ConfigTest.kt
  184. +106 −41 kotest-tests/kotest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/DescriptionTest.kt
  185. +2 −2 kotest-tests/kotest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/DisplayNameTest.kt
  186. +2 −2 kotest-tests/kotest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/FocusTest.kt
  187. +53 −51 kotest-tests/kotest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/IsActiveTest.kt
  188. +1 −1 kotest-tests/kotest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/OneInstancePerTestTest.kt
  189. +36 −34 kotest-tests/kotest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/SkipTestExceptionTest.kt
  190. +12 −11 kotest-tests/kotest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/TagExtensionTest.kt
  191. +4 −4 kotest-tests/kotest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/TagTest.kt
  192. +325 −314 kotest-tests/kotest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/TestCaseExecutorTest.kt
  193. +4 −4 kotest-tests/kotest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/TestCaseFilterTest.kt
  194. +4 −2 kotest-tests/kotest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/TestCasePrefixTest.kt
  195. +2 −2 ...s-core/src/jvmTest/kotlin/com/sksamuel/kotest/extensions/LateinitSpecInterceptorStringSpecTest.kt
  196. +16 −16 ...sts-core/src/jvmTest/kotlin/com/sksamuel/kotest/extensions/LateinitSpecInterceptorWordSpecTest.kt
  197. +3 −3 ...ts/kotest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/extensions/RuntimeTagExtensionTest.kt
  198. +5 −4 ...st-tests/kotest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/extensions/SpecExtensionTest.kt
  199. +2 −2 ...tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/extensions/TestCaseExtensionAroundAdviceTest.kt
  200. +3 −3 ...kotest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/extensions/TestCaseExtensionChainTest.kt
  201. +3 −3 ...ests/kotest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/extensions/TestCaseExtensionTest.kt
  202. +3 −3 ...t-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/listeners/LateInitBeforeSpecStringSpecTest.kt
  203. +2 −2 ...est-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/listeners/LateInitBeforeTestWordSpecTest.kt
  204. +3 −3 ...s/kotest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/listeners/TestListenerAfterSpecTest.kt
  205. +7 −7 ...-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/listeners/TestListenerBeforeSpecStartedTest.kt
  206. +8 −7 .../kotest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/listeners/TestListenerBeforeSpecTest.kt
  207. +3 −3 .../kotest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/listeners/TestListenerBeforeTestTest.kt
  208. +4 −4 kotest-tests/kotest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/listeners/TestListenerTest.kt
  209. +359 −359 ...st-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/runner/junit5/JUnitTestRunnerListenerTest.kt
  210. +3 −3 kotest-tests/kotest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/runner/junit5/Kotest.kt
  211. +58 −58 kotest-tests/kotest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/runner/jvm/IsolationTest.kt
  212. +53 −53 ...st-tests/kotest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/runner/jvm/TopLevelTestsTest.kt
  213. +7 −7 ...s/kotest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/specs/annotation/AnnotationSpecTest.kt
  214. +1 −1 ...t-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/specs/behavior/BehaviorSpecOneInstanceTest.kt
  215. +5 −4 ...tests/kotest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/specs/behavior/BehaviorSpecTest.kt
  216. +1 −1 ...t-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/specs/describe/DescribeSpecOneInstanceTest.kt
  217. +1 −1 ...otest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/specs/expect/ExpectSpecOneInstanceTest.kt
  218. +3 −3 ...mTest/kotlin/com/sksamuel/kotest/specs/feature/FeatureSpecCoroutineSingleTestIsolationModeTest.kt
  219. +1 −1 ...est-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/specs/feature/FeatureSpecOneInstanceTest.kt
  220. +6 −6 ...t-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/specs/freespec/FreeSpecInstancePerLeafTest.kt
  221. +2 −2 ...t-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/specs/freespec/FreeSpecInstancePerNodeTest.kt
  222. +1 −1 ...src/jvmTest/kotlin/com/sksamuel/kotest/specs/freespec/FreeSpecInstancePerTestDuplicateNameTest.kt
  223. +6 −6 ...t-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/specs/freespec/FreeSpecInstancePerTestTest.kt
  224. +5 −5 ...src/jvmTest/kotlin/com/sksamuel/kotest/specs/freespec/FreeSpecIsolationModeInstancePerLeafTest.kt
  225. +5 −5 .../src/jvmTest/kotlin/com/sksamuel/kotest/specs/freespec/FreeSpecIsolationModeSingleInstanceTest.kt
  226. +4 −4 ...ests-core/src/jvmTest/kotlin/com/sksamuel/kotest/specs/freespec/FreeSpecMultipleInvocationTest.kt
  227. +4 −4 kotest-tests/kotest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/specs/freespec/FreeSpecTest.kt
  228. +8 −8 ...st-tests/kotest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/specs/funspec/FunSpecExample.kt
  229. +20 −19 ...ts/kotest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/specs/funspec/FunSpecExampleNewDsl.kt
  230. +2 −2 kotest-tests/kotest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/specs/funspec/FunSpecTest.kt
  231. +7 −6 ...sts-core/src/jvmTest/kotlin/com/sksamuel/kotest/specs/shouldspec/ShouldSpecInstancePerLeafTest.kt
  232. +7 −6 ...sts-core/src/jvmTest/kotlin/com/sksamuel/kotest/specs/shouldspec/ShouldSpecInstancePerTestTest.kt
  233. +101 −101 ...src/jvmTest/kotlin/com/sksamuel/kotest/specs/stringspec/StringSpecCoroutineInstancePerLeafTest.kt
  234. +92 −92 ...est/kotlin/com/sksamuel/kotest/specs/stringspec/StringSpecCoroutineSingleTestIsolationModeTest.kt
  235. +6 −6 .../src/jvmTest/kotlin/com/sksamuel/kotest/specs/stringspec/StringSpecInstancePerLeafOrderingTest.kt
  236. +1 −1 ...jvmTest/kotlin/com/sksamuel/kotest/specs/stringspec/StringSpecInstancePerTestDuplicateNameTest.kt
  237. +6 −6 .../src/jvmTest/kotlin/com/sksamuel/kotest/specs/stringspec/StringSpecInstancePerTestOrderingTest.kt
  238. +10 −11 .../jvmTest/kotlin/com/sksamuel/kotest/specs/stringspec/StringSpecSingleInstanceDuplicateNameTest.kt
  239. +5 −1 ...tests/kotest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/specs/stringspec/StringSpecTest.kt
  240. +4 −4 ...mTest/kotlin/com/sksamuel/kotest/specs/stringspec/WordSpecCoroutineSingleTestIsolationModeTest.kt
  241. +1 −1 ...otest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotest/specs/wordspec/WordSpecOneInstanceTest.kt
  242. +4 −3 kotest-tests/kotest-tests-core/src/jvmTest/kotlin/io/kotest/provided/ProjectConfig.kt
  243. +0 −18 kotest-tests/kotest-tests-core/src/jvmTest/resources/log4j.xml
  244. +60 −0 kotest-tests/kotest-tests-discovery/build.gradle.kts
  245. +23 −0 ...st-tests/kotest-tests-discovery/src/jvmTest/kotlin/com/sksamuel/kotest/discovery/DiscoveryTest.kt
  246. +13 −0 kotest-tests/kotest-tests-discovery/src/jvmTest/resources/logback.xml
  247. +1 −1 kotest-tests/kotest-tests-junit5/build.gradle.kts
  248. +2 −2 ...tests/kotest-tests-junit5/src/jvmTest/kotlin/com/sksamuel/kotest/junit5/InitErrorEngineKitTest.kt
  249. +2 −2 ...test-tests-junit5/src/jvmTest/kotlin/com/sksamuel/kotest/junit5/StringSpecExceptionInAfterSpec.kt
  250. +2 −2 ...test-tests-junit5/src/jvmTest/kotlin/com/sksamuel/kotest/junit5/StringSpecExceptionInAfterTest.kt
  251. +2 −2 ...est-tests-junit5/src/jvmTest/kotlin/com/sksamuel/kotest/junit5/StringSpecExceptionInBeforeSpec.kt
  252. +2 −2 ...est-tests-junit5/src/jvmTest/kotlin/com/sksamuel/kotest/junit5/StringSpecExceptionInBeforeTest.kt
  253. +3 −3 kotest-tests/kotest-tests-junit5/src/jvmTest/kotlin/io/kotest/provided/ProjectConfig.kt
  254. +5 −4 ...st-tests/kotest-tests-timeout/src/jvmTest/kotlin/com/sksamuel/kotest/timeout/GlobalTimeoutTest.kt
  255. +27 −31 ...otest-tests-timeout/src/jvmTest/kotlin/com/sksamuel/kotest/timeout/TestCaseTimeoutListenerTest.kt
  256. +40 −39 kotest-tests/kotest-tests-timeout/src/jvmTest/kotlin/com/sksamuel/kotest/timeout/TimeoutTest.kt
  257. +5 −3 settings.gradle.kts
@@ -0,0 +1,9 @@
import org.gradle.kotlin.dsl.`kotlin-dsl`

repositories {
jcenter()
}

plugins {
`kotlin-dsl`
}
@@ -0,0 +1,50 @@
object Libs {

val kotlinVersion = "1.3.61"
val dokkaVersion = "0.10.0"

object JUnitPlatform {
private const val version = "1.6.0-RC1"
const val engine = "org.junit.platform:junit-platform-engine:$version"
const val launcher = "org.junit.platform:junit-platform-launcher:$version"
const val api = "org.junit.platform:junit-platform-suite-api:$version"
}

object JUnitJupiter {
private const val version = "5.6.0-RC1"
const val api = "org.junit.jupiter:junit-jupiter-api:$version"
const val engine = "org.junit.jupiter:junit-jupiter-engine:$version"
}

object Log4j {
private const val version = "2.13.0"
const val api = "org.apache.logging.log4j:log4j-api:$version"
const val core = "org.apache.logging.log4j:log4j-core:$version"
const val slf4j = "org.apache.logging.log4j:log4j-slf4j-impl:$version"
}

object Classgraph {
const val classgraph = "io.github.classgraph:classgraph:4.8.59"
}

object Logback {
const val classic = "ch.qos.logback:logback-classic:1.2.3"
}

object Slf4j {
const val api = "org.slf4j:slf4j-api:1.7.30"
}

object Coroutines {
private const val version = "1.3.3"
const val coreCommon = "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$version"
const val core = "org.jetbrains.kotlinx:kotlinx-coroutines-core:$version"
const val coreJs = "org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$version"
}

object Ktor {
private const val version = "1.2.6"
const val serverCore = "io.ktor:ktor-server-core:$version"
const val serverTestHost = "io.ktor:ktor-server-test-host:$version"
}
}
@@ -0,0 +1,5 @@
object Travis {
val isTravis = System.getenv("TRAVIS") == "true"
val travisBuildNumber: String = System.getenv("TRAVIS_BUILD_NUMBER") ?: "0"
val isReleaseVersion = !isTravis
}
@@ -0,0 +1,160 @@
A design for #598 and #399

Note: This PR replaces the previous PR. Most notable change is that test factories (previously value specs) are not in themselves considered executable units.

**Goal**:

To allow specs to be composed of smaller reusable specs. These abstractions should be easily parameterized, dynamic and mappable.

**Status**:

Currently this PR is incomplete. The basics are working but more changes are required before this can be considered completed.
I would rather merge sooner than later so that other contributors are not working against a codebase that could change.

**Implementation**:

This implementation adds a new type of "test container" called `TestFactory`. A TestFactory is a way of defining tests (and test related configuraton)
and then import those tests into a spec.

To create a test factory, we use a test factory builder function, for example:

```kotlin
val funTests = funSpec {
test("foo") {
1 + 1 shouldBe 2
}
test("bar") {
"a" + "b" shouldBe "ab"
}
}
```

Callbacks such as before/after can be defined inline, along with configuration. For example:

```kotlin
val funTests = funSpec {
beforeTest {
println("Starting test case ${it.name}")
}
afterTest { testCase, result ->
println(testCase.name + " is completed with result " + result)
}
assertionMode = AssertionMode.Error
test("my test") {
1 + 1 shouldBe 2
}
}
```

The aim of these test test factories is to allow reusable composable specs. Since the result of a test factory builder function is just a `TestFactory` instance,
they can be passed around, filtered, mapped, copied or whatever else you want to do. It's just a value. More importantly however, it can be
included as part other specs.

```kotlin
val tests = stringSpec {
"test 1" {
"abc".shouldHaveLength(3)
}
}
class MySpec : StringSpec() {
init {
include(tests)
"test 2" {
"".shouldHaveLength(0)
}
}
}
```

Note that you can even mix and match the spec styles when composing. The output reports will reflect the correct structure.

```kotlin
val funtests = funSpec {
test("test 1") {
"abc".shouldHaveLength(3)
}
}
val stringtests = stringSpec {
"test 2" {
"zyx".shouldHaveLength(3)
}
}
class MySpec : FunSpec() {
init {
include(funtests)
include(stringtests)
}
}
```

Since the test factory functions are just that - functions - they can dynamically generate tests based on parameters.

```kotlin
// defines an interface for the Semigroup typeclass
interface Semigroup<T> {
fun combine(a: T, b: T): T
}
object StringSemigroup : Semigroup<String> {
fun combine(a: String, b: String): T = "$a$b"
}
object LongSemigroup : Semigroup<Long> {
fun combine(a: Long, b: Long): T = a + b
}
// every semigroup should uphold the law that ((ab)c) == (a(bc))
fun <T> associativity(sg: SemiGroup<T>, a: T, b: T, c: T) = funSpec {
test("semigroup should be associative") {
sg.combine(a, sg.combine(b, c)) shouldBe sg.combine(sg.combine(a, b), c)
}
}
class StringSemigroupTest : FunSpec() {
init {
include(associativity(StringSemigroup, "a", "b", "c"))
test("combination") {
StringSemigroup.combine("a" ,"b") shouldBe "ab"
}
}
}
class LongSemigroupTest : FunSpec() {
init {
include(associativity(LongSemigroup, 1, 2, 3))
test("combination") {
LongSemigroup.combine(1, 2) shouldBe 3
}
}
}
```

Specs cannot be included into other specs, only test factories can be added to specs.

If you have some test factories and want to execute those without defining new tests, then you can use the `CompositeSpec` class.

```kotlin
val tests1 = funSpec { }
val tests2 = stringSpec { }
class SomeTests : CompositeSpec(tests1, tests2)
```








@@ -15,6 +15,5 @@ version=3.4.0
sandbox = .

# See https://dev.to/jmfayard/configuring-gradle-with-gradle-properties-211k
org.gradle.caching=true
org.gradle.parallel=true
kotlin.code.style=official
@@ -12,13 +12,9 @@ kotlin {

targets {
jvm {
targets {
jvm {
compilations.all {
kotlinOptions {
jvmTarget = "1.8"
}
}
compilations.all {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
@@ -44,15 +40,15 @@ kotlin {
val commonMain by getting {
dependencies {
implementation (kotlin ("stdlib-common"))
implementation ("org.jetbrains.kotlinx:kotlinx-coroutines-core-common:1.3.3")
implementation ("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3")
implementation(Libs.Coroutines.coreCommon)
}
}

val jsMain by getting {
dependsOn(commonMain)
dependencies {
implementation(kotlin("stdlib-js"))
implementation(Libs.Coroutines.coreJs)
}
}

@@ -61,6 +57,7 @@ kotlin {
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation(kotlin("reflect"))
implementation(Libs.Coroutines.core)
implementation("com.github.wumpz:diffutils:2.2")
implementation("com.univocity:univocity-parsers:2.8.3")
api("io.arrow-kt:arrow-core:0.10.3")
@@ -1,9 +1,9 @@
package com.sksamuel.kotest.assertions

import io.kotest.AssertionMode
import io.kotest.TestCase
import io.kotest.TestResult
import io.kotest.TestStatus
import io.kotest.core.AssertionMode
import io.kotest.core.TestCase
import io.kotest.core.TestResult
import io.kotest.core.TestStatus
import io.kotest.assertions.AssertionCounter
import io.kotest.extensions.TestCaseExtension
import io.kotest.matchers.string.shouldHaveLength
@@ -24,7 +24,8 @@ class AssertionCounterTest : FunSpec() {
"AssertionMode.Error assertion mode should fail the test if no assertions were present" -> {
execute(testCase) {
when (it.status) {
TestStatus.Error, TestStatus.Failure -> complete(TestResult.success(it.duration))
TestStatus.Error, TestStatus.Failure -> complete(
TestResult.success(it.duration))
else -> complete(TestResult.error(RuntimeException("Should have failed"), it.duration))
}
}

0 comments on commit f7f8b0e

Please sign in to comment.
You can’t perform that action at this time.