Currently I am using data provider like this
static Object[][] dataProvider() {
return new Object[][]{
[a],
[b],
[c],
}
}
Have testNG Options like this in build.gradle,
useTestNG() {
options ->
options.parallel = 'tests'
options.threadCount = 3
}
and have test like this,
@Test(dataProvider = "dataProvider", dataProviderClass = RunIdProvider.class)
void testFunction(String variable) {
// do something
}
Doing this allows me to kick off 3 tests in parallel each using data a or b or c.
I want to pass in a string parameter in jenkins say - a,b,c
and that should kick off 3 tests in parallel from testNG each using one of the values a or b or c.
More specifically the number of parallel tests kicked off should be based on number of comma separated values in the string - meaning if I pass in a,b,c,d - it should kick off 4 tests in parallel.
Is this possible ? Has anyone done this before ? Will greatly appreciate any example. Thanks!
You are perhaps looking for something like this:
Note:
csv_valuesin the suite file and tries to parse it as a csv only if it is found. If its not found it defaults to some default values.StringHere's how the test class that contains a dynamic data provider which is capable of transforming a csv into a data set would look like:
Here's how the suite file looks like:
Here's the execution output