0

Here's what I'm trying to do. I have a test that goes to the test page and perform some complex tasks, wait for a while and then take a screenshot if the test fails and uses OCR tool for further tasks. I want this same test to run on 10 chrome browser sessions simultaneously, we're trying to do a quasi load test with this and since the test is already complex enough using third party libraries, using something like WebDriver plugin for Jmeter doesn't look feasible here. In anycase, no matter what I try the test seems to run one after the other instead of opening 10 browser windows and running it in parallel. Here's what I've tried thus far from looking around the interwebs.

TestNG.xml route

<suite name="UI Tests" parallel="methods" preserve-order="true" thread-count="10">

did not work

Maven route

Added the following in pom.xml

...
<build>
 <plugins>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>3.0.0-M4</version>
    <configuration>
        <forkCount>10</forkCount>
        <reuseForks>true</reuseForks>
    </configuration>
  </plugin>
 </plugins>
</build>
...

tried something slightly hacky

Dataprovider route

Providing a unique data to the test so it can perhaps run the same test simultaneously but to no avail.

@DataProvider(name="Unique")
public static Object[][] unique(){
   return new Object[][] {
     {"someValue"},
     ....
     };
}

@Test(dataProvider="Unique")
public void test(String unique){
//test code
}

None of the above options have worked for me to run the same test multiple times simultaneously on chrome browser. Is there a better way of achieving it?

3
  • Did you try using e.g. the threadPoolSize and invocationCount arguments in the @Test annotation? Commented Jan 14, 2020 at 19:30
  • Wow this worked, didn't know it was this simple. Thanks! If you can add this as an answer I can mark it as accepted. Commented Jan 14, 2020 at 20:13
  • OK thanks - I added as answer Commented Jan 16, 2020 at 20:09

1 Answer 1

1

Did you try adding the threadPoolSize and invocationCount arguments to the @Test annotation?

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.