lundi 14 novembre 2016

TestNG.xml > only Executing First TestNG Test

TestNG.xml > only Executing First TestNG Test

  1. I have copied the exact same working project, setup etc on a new device(PC) but when executing the same testng.xml it seems to execute only the first @Test across all test cases.
  2. Running the test on my existing system works correctly.

  3. For example @Test(priority = 1) only seems to be executing across all my 100+ TestNG Test classes.

Example Test File:

    @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>

If i alter the above testng.xml to execute one test at a time the test executes fine.

Aucun commentaire:

Enregistrer un commentaire