Stan Smith
05/30/2024, 5:22 PMclasspath in the snippet of our build.gradle (below).
Relying on the convention for Test.testClassesDirs in custom Test tasks has been deprecated. This is scheduled to be removed in Gradle 9.0. Consult the upgrading guide for further information: <https://docs.gradle.org/8.7/userguide/upgrading_version_8.html#test_task_default_classpath>
Here is the relevant piece of the `build.gradle`:
task navigationTest(type: Test, dependsOn: cleanTest) {
useJUnit()
ignoreFailures false
include '**/somepath//navigation//NavigationTestSuite.class'
include '**/somepath//navigation//AccessibilityTestSuite.class'
}
I'm looking to get rid of some deprecation warnings in some of our gradle projects ahead of an upgrade 9.0 (whenever that comes out). We're running Gradle 8.7 currently.Stan Smith
05/30/2024, 8:51 PMtest task and customize it. Documentation here was helpful: https://docs.gradle.org/current/userguide/java_testing.htmlVampire
05/31/2024, 12:28 AMStan Smith
05/31/2024, 2:13 PMVampire
05/31/2024, 2:15 PMStan Smith
05/31/2024, 2:20 PMBy default, when applying theplugin, thejavaandtestClassesDirsof allclasspathtasks have the same convention. Unless otherwise changed, the default behavior is to execute the tests from the defaultTesttestby configuring the task with theTestSuiteandclasspathfrom thetestClassesDirssuite. This behavior will be removed in Gradle 9.0.test
While this existing default behavior is correct for the use case of executing the default unit test suite under a different environment, it does not support the use case of executing an entirely separate set of tests.
If you wish to continue including these tests, use the following code to avoid the deprecation warning in 8.1 and prepare for the behavior change in 9.0. Alternatively, consider migrating to test suites.I read this as you can get custom test tasks to work by adding
classpath and testClassesDirs, but that Gradle recommends migrating to test suites for more future proofing.Vampire
05/31/2024, 2:23 PMStan Smith
05/31/2024, 2:29 PMgradle test --tests 'org.name.example.common.*' --tests 'org.name.example.model.*' --tests 'org.name.example.appname.action.*'Vampire
05/31/2024, 2:36 PMVampire
05/31/2024, 2:37 PMVampire
05/31/2024, 2:38 PMVampire
05/31/2024, 2:38 PMStan Smith
05/31/2024, 2:38 PMgradle test --tests '**navigation*'*Stan Smith
05/31/2024, 2:38 PMVampire
05/31/2024, 2:40 PMsrc/test/... and functional tests in src/functionalTest/..., ...Stan Smith
05/31/2024, 2:40 PM