Adding secondary module with Kotest as dependency to primary module leads to primary module JUnit4 tests not being run when running them from Android Studio folder
See original GitHub issueKotest version: 4.2.5
Given
- An Android project with the next modules structure:
±
primary
±secondary
- The
secondary
module has Kotest configured like this (gradle.kts with correct kotest dependencies, here as constants):
android {
tasks.withType<Test>().all {
useJUnitPlatform()
}
}
...
testImplementation(kotestJunit5Runner)
testImplementation(kotestAssertions)
testImplementation(kotestProperty)
testRuntimeOnly(junitVintage)
- the
primary
module has thesecondary
module added as a dependency like this (gradle.kts):implementation(project(secondary))
- the
primary
module has neither Kotest dependencies nor tests written using Kotest
When
running tests using Android Studio via right-click on a primary
module package with tests -> select Run ‘Tests in ‘primary’’
Then
The tests are built but complete with error:
No tests were found
And the error message:
~~~ Kotest Configuration ~~~
-> Parallelization factor: 1
-> Default test timeout: 600000ms
-> Default test order: Sequential
-> Default isolation mode: SingleInstance
-> Global soft assertations: False
-> Write spec failure file: False
-> Fail on ignored tests: False
-> Spec execution order: SpecExecutionOrder
-> Extensions
- io.kotest.engine.extensions.SystemPropertyTagExtension
- io.kotest.core.extensions.RuntimeTagExtension
- io.kotest.engine.extensions.RuntimeTagExpressionExtension
Process finished with exit code 0
Expected result
The tests should work without error, there shouldn’t be any mentions of Kotest in the primary
module during running
Additional info
- The issues don’t depend on the state of Kotest IIntelliJ IDEA plugin (installed, not installed, installed but not enabled)
- If running tests using Gradle it works without issues
- Adding to the
primary
gradle.kts next configuration fixes the issue (given the plugin is unistalled)testRuntimeOnly(junitVintage)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Quick Start - Kotest
The Kotest test framework is supported on JVM, Javascript and Native. ... the tasks with type Test and then adding the Kotest junit5...
Read more >Why is library module android.support.test not visible in add ...
I had the same issue and I found that the dependencies with the androidTestCompile are visible only by default in the debug build...
Read more >Build local unit tests - Android Developers
A local test runs directly on your own workstation, rather than an Android device or emulator. As such, it uses your local Java...
Read more >kotlintest - Bountysource
Adding secondary module with Kotest as dependency to primary module leads to primary module JUnit4 tests not being run when running them from...
Read more >Best Practices for Unit Testing in Kotlin - Philipp Hauer's Blog
In JUnit4, a new instance of the test class is created for every test method. So the initial setup code (that is used...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t know why it’s not picking the deps up, but that’s the error. JUnit platform is saying it can’t find an engine implementation.
On Mon, 7 Feb 2022 at 15:03, Yaroslav Shlapak @.***> wrote:
The error in that stack is because it can’t find either jupiter or kotest.
On Sun, 6 Feb 2022 at 03:07, Yaroslav Shlapak @.***> wrote: