如何在其他JavaSelenium之后运行类
我需要在另一个类中的其他测试之后执行一个类中的测试。 我正在使用TestNG Java Selenium,我尝试使用dependsOnGroups,但无法使其正常工作。 这是我的两门课: 第一个是阻止用户并验证登录是否被禁用 @课前如何在其他JavaSelenium之后运行类,java,selenium,Java,Selenium,我需要在另一个类中的其他测试之后执行一个类中的测试。 我正在使用TestNG Java Selenium,我尝试使用dependsOnGroups,但无法使其正常工作。 这是我的两门课: 第一个是阻止用户并验证登录是否被禁用 @课前 public void setUp() throws Exception { this.setUpMaven(); } @AfterClass // call function to close browser public vo
public void setUp() throws Exception {
this.setUpMaven();
}
@AfterClass // call function to close browser
public void teardown(){
this.quitBrowser();
}
@Test
public void loginAsInactive() throws Exception{
personas = new PersonasPage(driver);
login = new LoginPage(driver);
Reporter.log(" Probar que un usuario inactivo no se puede loguear");
// Go to the configuration
this.goToConfiguration();
this.goToMenu();
// Go to Manage people
personas.goToPersonas();
WebElement someElement = (new WebDriverWait(driver, 20)).until(ExpectedConditions.presenceOfElementLocated(By.cssSelector(inputSearch)));
this.sendValue(inputSearch, "Inactive");
this.click(".tables tbody tr td:nth-child(7) a");
this.click(".basicdata label:nth-child(3) input ");
;
this.click(".container .addpeople .primary");
this.goToMenuUsuario();
this.logout();
login.loginToGo("marina.touceda+058@gointegro.com", "Auto1234");
Thread.sleep(2000);
Reporter.log(driver.findElement(By.cssSelector("p.reject")).getText());
另一个具有相同的设置,但必须激活用户并验证登录。
有人能给些指导吗?
谢谢 如果您可以作为testng套件运行,这将变得非常简单。如果您不知道如何创建testng.xml,请执行以下步骤
Right click on src folder (as per eclipse)
Go to TestNG and select Convert to TestNG
testng.xml preview is displayed with all TestNG classes which contains @Test methods
Click on Finish
完成后,打开testng.xml文件,如果还有更多的类,则保留所需的类,这里按所需顺序需要两个,并使用
preserve-order="true"
按提供的顺序运行类。
它看起来像下面
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite" preserve-order="true">
<test name="Test1">
<classes>
<class name="com.test.Test1"/>
<class name="com.test.Test2"/>
</classes>
</test> <!-- Test -->
只需在xml文件上方运行
谢谢,,
穆拉里你看过测试套件了吗?您可以在这些测试用例中分组并按顺序执行它们。是的,我已经设置了使用TestNG运行这些类。最后我可以使用{depends on“test”}来运行这些类。谢谢您的回复。。!