I am running my test suite through testNG xml. Here is the xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" data-provider-thread-count="4" parallel="methods">
<test name="Test" group-by-instances="true" parallel="instances">
<classes>
<class name="packageName"></class>
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->
I am using the data-provider with annotation parallel=true. I have like 2000 test cases which runs in a loop through one test case with different data. The test runs well when its not parallel. When i try to run the test in parallel, in 4 threads, the before and after method gets executed in the same thread, however my test method is allocated altogether different thread. How do i make sure that for a test case, before method , after method and test all run in the same thread for a test instance.
Did you tried singleThreaded? like below example
@Test(singleThreaded = true)
public class DemoForMethodOrdering {
///implementation here
}
please find information about singleThreaded in testng doc here
Thank You, Murali
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.