citrusframework / citrusframework/citrus

Incorrect parameter value passed to test when using TestNG DataProvider with attribute parallel set to true

Open
#350 5 comments 5 reactions 0 assignees View on GitHub
enhancement prio-medium
Dominant language
Java
Stars
485
Forks
155
Avg merge
4d 22h
Merged PRs (30d)
6

Description

# Related to #83

## Scenario:
Trying to use TestNG DataProvider together with TestRunner resource injection. DataProvider attribute parallel = true

## Testcase:
public class DataProviderTest extends TestNGCitrusTest {

private static final Logger log = LoggerFactory.getLogger(DataProviderTest.class);

@DataProvider(name = "getTestData", parallel = true)
public Object[][] getTestData() {
return new String[][]{
{"foo", null},
{"bar", null},
};
}

@Test(testName = "dataProviderAndCitrusResourceInjectionTest",
dataProvider = "getTestData")
@CitrusTest(name = "dataProviderAndCitrusResourceInjectionTest")
@Parameters({"dataRecord", "runner"})
public void dataProviderAndCitrusResource(String dataRecord, @CitrusResource TestRunner runner) {
runner.echo("Hello Citrus Test World.");
log.info("DataProvider dataRecord = " + dataRecord);
}
}

## Expected result:
Log contains string "DataProvider dataRecord = foo" and "DataProvider dataRecord = bar"

## Actual result:
[PoolService-0] INFO ple.DataProviderTest| DataProvider dataRecord = foo
[PoolService-1] INFO ple.DataProviderTest| DataProvider dataRecord = foo

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the shown DataProviderTest with parallel=true and inspect how TestNG parameters and the @CitrusResource TestRunner are injected. Done means the parallel runs log the distinct data values "foo" and "bar" once each, rather than logging "foo" twice.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.