TestNG.xml>仅执行第一次TestNG测试
在我现有系统上运行测试的工作正常。
例如 @Test(priority = 1)似乎只在所有100多个TestNG测试类中执行。
示例测试文件:
@Test(priority = 1)
public void LoadPage() throws Exception {
basePage.loadPage();
//Logs whether the Url and page Title is correct
DOMConfigurator.configure("log4j.xml");
Log.info("@PASS ---> Expected Site URL: " + basePage.page_url + " | Found the following Site URL: " + basePage.getPageUrl());
Log.info("@PASS ---> Expected Page Title: " + basePage.page_title + " | Found the following title: " + basePage.getPageTitle());
}
@Test(priority = 2)
public void hutLocaliseAndSelectOrderType() throws Exception {
phHomepage.enterHutPostcode();
hutLocalisePage.selectOrderType();
}
@Test(priority = 3)
public void SignIntoAccount() throws Exception {
basePage.pageJSLoadAndClick(pageHeader.button_SignIn);
//Sign into Account
signInPage.signIntoAccount();
//Validate whether Sign Out button is visible, once successfully signed into account
pageHeader.signOutButtonIsDisplayed();
}
**Listed in BasePage.java class**
public void loadPage() throws Exception{
driver.get(page_url);
Assert.assertEquals(driver.getCurrentUrl(), getPageUrl());
Assert.assertEquals(driver.getTitle(), getPageTitle());
}
<suite name="PH_Automation_Scripts_by_GBruno" verbose="2">
<test name="PH Automation Tests: Pizza Combinations" parallel="false">
<packages>
<package name="PhFramework.pizzas.*" />
</packages>
</test>
如果我改变上面的testng.xml来一次执行一个测试,那么测试就可以了。
答案 0 :(得分:0)
@ Phil_P85 - 这是你的testng xml文件。
<suite name="PH_Automation_Scripts_by_GBruno" verbose="2">
<test name="PH Automation Tests: Pizza Combinations" parallel="false">
<packages>
<package name="PhFramework.pizzas.*" />
</packages>
</test>
你能描述一下'PhFramework.pizzas。*'吗?如果'pizzas'是你的包裹,你可以试着“看看它是否有效。”