Slackbot
07/27/2023, 3:57 AMChris Lee
07/27/2023, 4:06 AMEndre Deak
07/27/2023, 4:14 AMEndre Deak
07/27/2023, 4:14 AM.
s like my.package
, and I moved them to my/package
folder structureChris Lee
07/27/2023, 4:20 AMEndre Deak
07/27/2023, 6:05 AMsrc/test/kotlin/my.package/Test.kt
and now its src/test/kotlin/my/package/Test.kt
Chris Lee
07/27/2023, 9:08 AMEndre Deak
07/27/2023, 1:32 PMChris Lee
07/27/2023, 1:34 PMsrc/test/kotlin/my.package/Test.kt
- it isn’t a valid package name. What is the package declaration in Test.kt
?Chris Lee
07/27/2023, 1:41 PM./gradlew test
; it will show the tasks (and their dependencies), whether it compiled any files or not, etc.Endre Deak
07/27/2023, 2:23 PMTest.kt
it's:
package my.package
class Test {
@Test
fun foo() {
// my test logic
}
}
Endre Deak
07/27/2023, 2:23 PMmy.package
, it's just the storing directory which was named incorrectlyEndre Deak
07/27/2023, 2:35 PMExecution failed for task ':my:unit-test'.
> No tests found for given includes: [my.package.Test.get status of non-existing job throws error](--tests filter)
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at <https://help.gradle.org>.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to <https://docs.gradle.org/8.2.1/userguide/command_line_interface.html#sec:command_line_warnings> in the Gradle documentation.
BUILD FAILED in 19s
21 actionable tasks: 21 executed
Chris Lee
07/27/2023, 2:35 PMChris Lee
07/27/2023, 2:36 PMEndre Deak
07/27/2023, 2:37 PM> Task :my:compileKotlin
> Task :my:compileJava NO-SOURCE
> Task :my:classes
> Task :my:compileTestKotlin
> Task :my:compileTestJava NO-SOURCE
> Task :my:testClasses
> Task :my:unit-test
> Task :my:unit-test FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':my:unit-test'.
> No tests found for given includes: [my.package.Test.get status of non-existing job throws error](--tests filter)
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at <https://help.gradle.org>.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to <https://docs.gradle.org/8.2.1/userguide/command_line_interface.html#sec:command_line_warnings> in the Gradle documentation.
BUILD FAILED in 19s
21 actionable tasks: 21 executed
Chris Lee
07/27/2023, 2:37 PM> Task :my:compileTestJava NO-SOURCE
check where the source sets are configured for and the layout of src/test/java
Endre Deak
07/27/2023, 2:37 PMEndre Deak
07/27/2023, 2:37 PMChris Lee
07/27/2023, 2:38 PMChris Lee
07/27/2023, 2:38 PM> No tests found for given includes: [my.package.Test.get status of non-existing job throws error](--tests filter)
Endre Deak
07/27/2023, 2:39 PMChris Lee
07/27/2023, 2:39 PMtest
task?Endre Deak
07/27/2023, 2:40 PMEndre Deak
07/27/2023, 2:40 PMEndre Deak
07/27/2023, 2:41 PMsubprojects {
afterEvaluate {
tasks.create<Test>("unit-test") {
group = "verification"
useJUnitPlatform {
excludeTags("integrationtest", "systemtest")
}
}
tasks.withType<Test> {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
}
}
}
Chris Lee
07/27/2023, 2:42 PM./gradlew unit-test
do the tests run?Chris Lee
07/27/2023, 2:43 PMsubprojects
and afterEvaluate
are anti-patterns, they cause all kinds of challenges. Not this one, though. Something to consider cleaning up.Endre Deak
07/27/2023, 2:43 PMEndre Deak
07/27/2023, 2:43 PMEndre Deak
07/27/2023, 2:43 PMChris Lee
07/27/2023, 2:44 PMtasks.create<Test>("unit-test") {
group = "verification"
useJUnitPlatform {
excludeTags("integrationtest", "systemtest")
}
}
is a new Test task - is it somewhere wired to a source set? Otherwise it won’t know what to execute.
If your unit tests are in src/test/kotlin
then ./gradlew test
will run them.Chris Lee
07/27/2023, 2:46 PMEndre Deak
07/27/2023, 2:47 PMChris Lee
07/27/2023, 2:48 PMChris Lee
07/27/2023, 2:49 PMEndre Deak
07/27/2023, 2:50 PMunit-test
from the root project several tests are running, but not the one I have hproblem with.Chris Lee
07/27/2023, 2:50 PMunit-test
task? There has to be, somewhere, otherwise its an empty task.Endre Deak
07/27/2023, 2:51 PMChris Lee
07/27/2023, 2:52 PMEndre Deak
07/27/2023, 3:03 PMEndre Deak
07/27/2023, 3:03 PMEndre Deak
07/27/2023, 3:22 PMEndre Deak
07/27/2023, 3:22 PMEndre Deak
07/27/2023, 3:22 PMEndre Deak
07/27/2023, 3:22 PMEndre Deak
07/27/2023, 3:23 PMChris Lee
07/27/2023, 4:26 PMEndre Deak
07/27/2023, 6:31 PM