Slackbot
11/09/2022, 9:47 AMVampire
11/09/2022, 9:51 AMCristianGM
11/09/2022, 9:55 AM./gradlew :whatever:test -DincludeCategories=cat1
and
./gradlew :whatever:test -DincludeCategories=cat2
but the issue is JUnitOptions.includeCategories(String...)
is doesn't accept a Provider, so it requires to be changed in configuration timeCristianGM
11/09/2022, 10:04 AMVampire
11/09/2022, 10:09 AMgetTestFrameworkProperty
. It is the Property
that carries the test framework to use, so you can maybe there make the settings lazily?Vampire
11/09/2022, 10:10 AMuseJUnit()
and then something like testFrameworkProperty.set(testFrameworkProperty.map { ... }
or something like that. But I'm not sure whether that will then end up in a circular reference.CristianGM
11/09/2022, 10:11 AMVampire
11/09/2022, 10:17 AMStackOverflowError
due to the circular reference.CristianGM
11/09/2022, 10:21 AMjava.lang.StackOverflowError
it isVampire
11/09/2022, 10:23 AMCristianGM
11/09/2022, 10:26 AMVampire
11/09/2022, 10:27 AMCristianGM
11/09/2022, 10:28 AMVampire
11/09/2022, 10:29 AMVampire
11/09/2022, 10:30 AMVampire
11/09/2022, 10:32 AMCategories
runner that does not take the categories from an annotation but from somewhere else.Vampire
11/09/2022, 10:32 AMVampire
11/09/2022, 10:35 AMCategoryFilter
might be what you need to programatically define which categories to includeCristianGM
11/09/2022, 10:40 AMCristianGM
11/09/2022, 11:15 AMtasks.withType(Test).configureEach {testTask ->
testTask.testFrameworkProperty.set( provider {
def tf = new JUnitTestFramework(testTask, (DefaultTestFilter) testTask.getFilter())
Provider<String> includedCategories = providers.systemProperty("includeCategories")
if (includedCategories.isPresent()) {
(tf.options as JUnitOptions).includeCategories(includedCategories.get().split(","))
}
return tf
})
}
it seems to work (although I have no tests in there) but then CC is not reused when I change the includeCategories
CristianGM
11/09/2022, 11:17 AMtestFrameworkProperty
is read during configuration time anyway (I guess it makes sense as changing the framework may affect many things)Vampire
11/09/2022, 11:46 AMVampire
11/09/2022, 11:47 AM