-1

I am trying to run the test parallel using dataprovider. I have mentioned dataproviderthreadcount=3 in testng 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="3"parallel="methods">
    <test name="Test">
        <classes>
            <class name="com.sample.test">
            </class>
        </classes>
    </test> <!-- Test -->
</suite> <!-- Suite -->

Test methods:

@Test(dataProvider = "dp1", threadPoolSize=3,invocationCount=1)
public void Testsuitesample(String url, String add1, String add2){}

Result: 3 browser instances get opened and all three data is passing to only browser. Other browser's are still idle. Is it a way to resolve this?

krlzlx
  • 5,752
  • 14
  • 47
  • 55
Madhu
  • 3
  • 2

1 Answers1

0

You may need to set parallel to true in your data provider method like,

@DataProvider(parallel = true)
public Object[][] dp1() {

}

Also, the invocation count should be equal or greater than the thread pool size.

Murthi
  • 5,299
  • 1
  • 10
  • 15
  • @DataProvider(parallel = true) - it is already set . I have set the invocation count and thread pool size as mentioned. But No luck. Still facing the same issue. – Madhu Jun 08 '18 at 07:32
  • @Madhu - Please edit your question and add proper sample code which demonstrates the problem. The code you have shared shows no information around the problem that you are talking about. (There is no browser instantiation logic etc., shown) – Krishnan Mahadevan Jun 09 '18 at 04:33
  • @Test(dataProvider = "dp1", threadPoolSize=3,invocationCount=1) public void Testsuitesample(String Browser, String url, String add1, String add2){ OpenBrowser(browser); LaunchURL(url); }. – Madhu Jun 11 '18 at 05:38
  • can you add the code for dp1 method? and invocation count should be greater than or equal to threadPoolsize – Murthi Jun 11 '18 at 05:40
  • @Murthi@DataProvider(parallel = true) - it is already set . I have set the invocation count and thread pool size as mentioned. But No luck. Still facing the same issue. – Madhu 2 days ago – Madhu Jun 11 '18 at 06:10
  • As per your code, You set invocation count to 1. it should be 3 or >3 – Murthi Jun 11 '18 at 06:13
  • @Murthi,I have tried all the possibility. No luck.. Do you know how add a parameter "dataproviderthreadcount" in cmd prompt – Madhu Jun 12 '18 at 06:50
  • yes, you can pass the parameter like mvn -Ddata-provider-thread-count="6" test – Murthi Jun 12 '18 at 06:54
  • java -cp D:\backup\Sample\lib\testng-6.8.jar;D:\backup\Sample\lib\jcommander-1.27.jar;D:\backup\Sample\lib\*;D:\backup\Sample\target\classes; org.testng.TestNG testng.xml -dataproviderthreadcount 2 – Madhu Jun 12 '18 at 10:20
  • @Murthi No... it is not userdefined – Madhu Jun 12 '18 at 14:02