3

I have a csv test data file with 50+ test data in it. I want my JUnit test to process these 50+ test data in parallel than serially. How can we do that? Is there a framework that can do that?

Junit test:

@Test
@FileParameters(value = "classpath:csvFileName.csv", mapper = CsvWithHeaderMapper.class)
public void testData(parameters)
{
  //code to test
}
1

The question is quite old but for the people who faces similar problems there are some good news. JUnit5 supports parallel test run out of the box. Such execution works with data providers so parallel threads would use their own particular pieces of data.

Here are some refs:

| improve this answer | |
0

There are several solutions that add parallelization to JUnit:

However, I'm not sure how they work with .csv files.

| improve this answer | |
0

By default I believe it runs tests sequentially.

JUnit 4.6 introduced an experimental ParallelRunner to run tests in parallel - I don't know of its current status. I would expect parallelism to remain an "opt-in" feature by default though. (Judging by other answers, it looks like this is now here to stay but in a slightly different form - and still opt-in.)

Good Luck

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.