Hey,
I am trying to run gradle integration test task multiple times and set a java system property used by the test classes to a different value each time.
My goal is to run all tests part of a particular category, while setting all categories as default.
Unfortunately, this is not working. Looks like the tests are executed only with the last listed category.
I tried making ‘singleCategory’ an external property but this did not help.
Any idea how to do this so that it works?
Here is how the task looks:
String categories = "${project.findProperty(‘requiredCategory’) ?: “com.pcbsys.nirvana.junit.categories.TestClassifier.PromotionIntegrationTest,com.pcbsys.nirvana.junit.categories.TestClassifier.PromotionSystemTest,com.pcbsys.nirvana.junit.categories.TestClassifier.PromotionUnitTest,com.pcbsys.nirvana.junit.categories.TestClassifier.PromotionPerformanceTest”}"
String suite = "${project.findProperty(‘requiredSuite’) ?: ‘com/pcbsys/foundation/suites/PromotionTests.class’}"
integrationTest {
String[] allCategories = categories.split(",");
String singleCategory;
for (int i = 0; i < allCategories.length; i++) {
singleCategory = allCategories[i];
System.out.println("**********************Running: $suite with category: $singleCategory**********************");
useJUnit {
include suite
systemProperties = [
//'EXCEPTION_INSTRUMENT_AGENT' : exceptionInstrumentJarPath,
'LOGLEVEL' : System.getProperty ("logLevel", "1"),
'EnableDebug' : System.getProperty ("debugFlag", "none"),
'LICENCE_DIR' : basedir + "/build/builds/nirvana/launchers/server",
'LICENCE_FILE' : "licence.xml",
'JUnitBasePort' : junitBasePort,
'nirvana.test.requiredCategories' : singleCategory
]
}
}
String[] categoryParticles = singleCategory.split("\\.");
String reportName = categoryParticles[6];
def reportsDirectory = "$projectDir/$reportName"
reports {
html.destination = reportsDirectory
junitXml.destination = reportsDirectory
}
}
String[] categoryParticles = singleCategory.split("\\.");
String reportName = categoryParticles[6];
def reportsDirectory = "$projectDir/$reportName"
reports {
html.destination = reportsDirectory
junitXml.destination = reportsDirectory
}
}