Adding integration tests to Kotlin project using t

2019-05-11 08:54发布

问题:

I would like to add an additional "source set" to a Kotlin project that will contain integration tests. I have seen a few posts that talk about doing it for either a vanilla Java project or for Kotlin but using Groovy rather than the Kotlin Gradle DSL.

In summary, using the Kotlin Gradle DSL:

  • how to add an additional "source set" that can contain Kotlin code, Java code & resources for the purpose of separating integration tests from regular unit tests?
  • how to add an additional task and configuration to run the integration tests separately from unit tests?

I would expect the directory structure to look something like:

src
   main
      java
      kotlin
      resources
   test
      java
      kotlin
      resources
   integration
      java
      kotlin
      resources

Related:

  • https://ryanharrison.co.uk/2018/07/25/kotlin-add-integration-test-module.html

  • https://www.petrikainulainen.net/programming/gradle/getting-started-with-gradle-integration-testing/

  • How do I add a new sourceset to Gradle?

Thanks