I have a simple test
@Test
public void searchInGoogle() {
final String searchKey = "TestNG";
System.out.println("Search " + searchKey + " in google");
driver.navigate().to("http://www.google.com");
WebElement element = driver.findElement(By.name("q"));
System.out.println("Enter " + searchKey);
element.sendKeys(searchKey);
System.out.println("submit");
element.submit();
System.out.println("Got " + searchKey + " results");
}
I want to run it 10 times in parallel, Meaning 10 chrome windows will open parallel and execute the same test.
Please help , I've seen things similar but not exactly this.
Thanks !
In JUnit 5 you can use @RepeatedTest to run a single test case multiple times.
Though presently still an experimental feature, you can also specify that tests should be executed in parallel , by setting the junit.jupiter.execution.parallel.enabled
to true as part of your JUnit 5 configuration settings .
Your code would then look as follows:
@Execution(CONCURRENT)
class GoogleSearchTest {
import ...
@RepeatedTest(10)
public void searchInGoogle() {
...
}
}
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.