У меня есть два теста в классе. При параллельном запуске TestNg он объединяет все тестовые данные и помещает их в один браузер, а другой браузер пуст.
selenium Версия: 3.8.21 Firefox: Последняя версияtestng: 6.8.21
Ниже приведен код
package cli;
import java.net.MalformedURLException;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class test1 {
public WebDriver driver;
@BeforeMethod
public void setUp() throws MalformedURLException {
System.out.println("@BeforeMethod: The annotated method will be run before each test method.");
}
@Test
public void test() throws MalformedURLException, InterruptedException {
driver = jenkinHub.hub();
driver.get("https://www.google.com/");
driver.findElement(By.xpath("//*[@id=\"lst-ib\"]")).sendKeys("Testing");
System.out.println("This is current Url " + driver.getCurrentUrl());
Thread.sleep(9000);
driver.quit();
}
@Test
public void NotTesting() throws MalformedURLException, InterruptedException {
driver = jenkinHub.hub();
driver.get("https://www.google.com/");
driver.findElement(By.xpath("//*[@id=\"lst-ib\"]")).sendKeys("Not Testing");
System.out.println("This is current Url " + driver.getCurrentUrl());
Thread.sleep(9000);
driver.quit();
}
}
xmlFile
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Regression Suite" verbose="1" parallel="methods" thread-count="3">
<test name="REgressionSuite" group-by-instances="true">
<classes>
<class name="cli.test1" />
</classes>
</test>
</suite>