I use this method to setup my parameterized data:
@Parameterized.Parameters
public static Collection<Object[]> getStories() {
Collection<Object[]> allStories = new ArrayList<Object[]>()
new File(SPEC_DIRECTORY).eachFileRecurse(FileType.FILES) { file ->
if (file.getName().endsWith('.story')) {
Object[] args = [file.getName(), file]
allStories << args
}
}
return allStories
}
I invoke the main test with gradle via gradle test, but I do not seem to be able to see system properties.
If I use the invocation gradle -Dfile=test.story, then System.getProperty('file') is undefined. How can I pass arguments to this parameterized data builder?
Gradle runs all tests in a separate JVM. You have to configure the
testtask:For more information, see the Gradle DSL reference.