Open StYura opened 2 years ago
hi, could please specify where @Step("Execute orders for single user")
comes from, seems not a supported annotation from TestNG.
hi, could please specify where
@Step("Execute orders for single user")
comes from, seems not a supported annotation from TestNG.
Yeah. @Step("Execute orders for single user") and @TestInstanceParameter are Allure report framework annotations. You can ignore(or delete) them completely.
@StYura - Can you please help post a cleaned up test case, that can be used to simulate the problem ? One that doesn't use any other libraries etc., ?
Dataprovider thread count set to 5. Factory (to which data is provided) creates test classes based on processed dataprovider data. All created tests are executed in the same thread pull regardless of dataprovider thread. Dataprovider does not seem to creat threads based on data it provides. Tests are getting executed based only on test classes created by Factory
The attribute dataproviderthreadcount
is intended to just ensure that the data provider starts providing test data in parallel instead of in a sequential order. This is usually relevant when you tie a dataprovider to a @Test
method. This perhaps does not have any relevance when you tie it to a factory.
When you are working with factories that are powered by data provider, then you should be using parallel="instances"
which will ensure that TestNG starts running all the tests in each of the instances in parallel.
Also if you are saying all this based on some documentation within TestNG, please help point me to it, because this looks to be a documentation bug.
In a nutshell.
dataproviderthreadcount
- Is relevant when you tie a @Test
method with a data provider, so that the test method can be run for all the iterations from the data provider in parallel, instead of invoking the same test method for n sets of data, all one after the other.parallel=instances
should be used when you have a factory that is powered by a dataprovider because here the data provider is going to be called in conjunction with a constructor, to create multiple instances and the parallel instances is now going to cause it to happen in parallel.
TestNG Version 7.0 and 7.5
If Factory used with dataprovider with dataproviderthreadcount set to 5. Factory creates thread irrelevant to dataproviderthreadcount. Xml setup based on parallel="instances", "methods", "classes", "tests" are not helpful here cause though it changes behaviour it does not allow for multithreading based on dataprovider and sequential execution on test class level.
Expected behavior
Dataproviderthreadcount set to 5. Factory (to which data is provided) creates test classes based on processed dataprovider data. Tests getting executed in order of dataprovider provides data. In other words, expected that dataprovider is creating a thread with a single data set. That set of data is executed sequentially (see example)
@DataProvider(parallel = true) public Object[][] getDummies2() {
<- I`m expecting that here thread is created@Factory(dataProvider = "getDummies2")
<- and form here test is executed in single thread, sequentially for every element ofList<String> params
Actual behavior
Dataprovider thread count set to 5. Factory (to which data is provided) creates test classes based on processed dataprovider data. All created tests are executed in the same thread pull regardless of dataprovider thread. Dataprovider does not seem to creat threads based on data it provides. Tests are getting executed based only on test classes created by Factory
here we can see that tests with same key are getting executed at very same time e.g.
and
different threads but same key
Is the issue reproducible on runner?
Test case sample
Thanks!