0

We use threadcount attribute in @Test annotation of TestNg but there is no such attribute for @DataProvider annotation so is it possible to specify the thread count for Dataprovider, if yes then how? I specified Parallel=true in @DataProvider annotation and tried to read the data from Excel, there were 19 sets of test data and when executed then by default I found that 10 threads got created. I used Thread.currentThread() along with each set of Test Data to display the thread being used but I failed to understand the process and reason for 10 threads getting created.Output

1 Answer 1

2

That is because 10 is used as the default value by testng when parallel is set to true on a DataProvider. This can be overridden by data-provider-thread-count attribute on the suite tag. Example:

<suite name="Sample Suite" data-provider-thread-count="20"> <test name="Component Tests"> <packages> <package name="com.something.tests" /> </packages> </test> </suite> 

The testng documentation on DataProvider has this and much more: http://testng.org/doc/documentation-main.html#parameters-dataproviders

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.