testng中每个类仅执行优先级为1的测试

时间:2019-02-25 20:04:02

标签: testng priority-queue

我有2个类,每个类包含从1到10优先的10种测试方法,现在当我将这些文件放在testng.xml中时,只有优先级为1的测试方法得到执行,而其余的则没有。请在下面找到代码详细信息。

但是,如果我删除优先级,则所有方法都将执行。

注意:对于每个测试,我都会打开浏览器,执行操作,然后关闭驱动程序。

package com.pmsnm.baseTest;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;


import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.ITestContext;
import org.testng.ITestResult;
import org.testng.Reporter;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Parameters;

import com.pmsnm.Utilities.AutoConstants;
import com.pmsnm.Utilities.ExcelReadAndWrite;
import com.pmsnm.Utilities.SNM_Login;
import com.pmsnm.Utilities.ScreenShot;
import com.pmsnm.Utilities.StoreAndRetreiveDataFromMap;
import com.sun.xml.bind.v2.schemagen.xmlschema.List;

public class BasePageSNM implements AutoConstants
{

    public StoreAndRetreiveDataFromMap data;
    public WebDriver driver;
    Map<String, Integer> numSeriesIndex;
    public ExcelReadAndWrite read;
    public SNM_Login login;

    /*@BeforeSuite
    public void initializeGlobalValues(ITestContext itest)
    {

        ArrayList<String> list = new ArrayList<String>();
        list.add("SNM_Data");
        list.add("Directory_Data");
        System.setProperty(chromeKey, chromePath);
        System.setProperty(firefoxKey, firefoxPath);
        data = new StoreAndRetreiveDataFromMap();
        data.storeDataToMap(excelPath, list);
    }*/

    @BeforeSuite(alwaysRun=true)
    public void initializeGlobalValues()
    {
        System.setProperty(chromeKey, chromePath);
        System.setProperty(firefoxKey, firefoxPath);
        /*login = new SNM_Login();
        read = new ExcelReadAndWrite();*/
    }

    /*@BeforeMethod
    public void beforeMethod()
    {
        driver = new FirefoxDriver();
        driver.manage().window().maximize();
        driver.manage().deleteAllCookies();
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
        driver.get(data.excelData.get("SNM_Data").get("URL"));
    }*/


    @BeforeClass(alwaysRun=true)
    public void beforeClass()
    {
        login = new SNM_Login();
        read = new ExcelReadAndWrite();
    }


    @AfterClass(alwaysRun=true)
    public void afterClass()
    {

    }


    //@Parameters("browser")
    @BeforeMethod(alwaysRun=true)
    public void beforeMethod()
    {
        /*if(browser.equalsIgnoreCase("firefox"))
        {
            driver = new FirefoxDriver();
        }
        else if(browser.equalsIgnoreCase("chrome"))
        {
            driver = new ChromeDriver();
        }*/
        driver = new FirefoxDriver();
        //login = new SNM_Login();
        //read = new ExcelReadAndWrite();
        driver.manage().window().maximize();
        driver.manage().deleteAllCookies();
        driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
        System.out.println("value of excel object:="+read);
        read.fetchExcelData("SNMLogin_Data", excelPath);
        driver.get(read.getData(1, 1));
    }


    @AfterMethod(alwaysRun=true)
    public void afterMethod(ITestResult res)
    {
        System.out.println("In after method");
        int status = res.getStatus();
        if(status==2)
        {
            String methodName = res.getMethod().getMethodName();
            ScreenShot.getScreenshot(driver, methodName);
        }

        driver.close();
    }
}
package com.snm.test;

import java.util.ArrayList;

import org.testng.Assert;
import org.testng.annotations.Test;

import com.pmsnm.Utilities.SelectDropDownValue;
import com.pmsnm.baseTest.BasePageSNM;
import com.snm.pageObjects.NumberPlan;
import com.snm.pageObjects.NumberSeries;
import com.snm.pageObjects.Number_Analysis_Page;
import com.snm.pageObjects.SNM_Login_Page;
import com.snm.pageObjects.SNM_Main_Page;
import com.snm.pageObjects.ToolsPage;

public class DeletingInternalNumberSeries extends BasePageSNM
{
    Number_Analysis_Page numAnalysisPage;
    NumberPlan numberPlan;
    NumberSeries numberSeries;
    ToolsPage tpage;
    SNM_Login_Page slp;
    SNM_Main_Page smp;
    SelectDropDownValue select;
    ArrayList<Integer> list = new ArrayList<Integer>(); 

    @Test(priority=1, groups= {"smoke"})
    public void deletingDirectoryNumbers()
    {
        slp = new SNM_Login_Page(driver);
        smp = new SNM_Main_Page(driver);
        numberPlan = new NumberPlan(driver);
        numAnalysisPage = new Number_Analysis_Page(driver);
        numberSeries = new NumberSeries(driver);
        login.loginToSNM(slp, read, 1, 2, 3);
        read.fetchExcelData("Number_Series", excelPath);
        smp.getNumber_Analysis().click();
        numAnalysisPage.getNumber_Plan_Link().click();
        numberPlan.getNumberSeries().click();
        numberSeries = new NumberSeries(driver);
        new SelectDropDownValue().selectByIndex(numberSeries.getNumberSeriesDropDown(), read.getData(1, 4));
        numberSeries.getNumberSeriesViewButton().click();
        //numberSeries.getDeleteDirectoryNumbers().click();
        try 
        {
            numberSeries.deleteAnyNumberSeries(driver, numberSeries, read.getData(1, 3));
        } catch (InterruptedException e) 
        {
            e.printStackTrace();
        }
    }   

    @Test(priority=2)
    public void deletingCommonOPeratorNumbers()
    {
        slp = new SNM_Login_Page(driver);
        smp = new SNM_Main_Page(driver);
        numberPlan = new NumberPlan(driver);
        numAnalysisPage = new Number_Analysis_Page(driver);
        numberSeries = new NumberSeries(driver);
        login.loginToSNM(slp, read, 1, 2, 3);
        read.fetchExcelData("Number_Series", excelPath);
        smp.getNumber_Analysis().click();
        numAnalysisPage.getNumber_Plan_Link().click();
        numberPlan.getNumberSeries().click();
        numberSeries = new NumberSeries(driver);
        new SelectDropDownValue().selectByIndex(numberSeries.getNumberSeriesDropDown(), read.getData(2, 4));
        numberSeries.getNumberSeriesViewButton().click();
        //numberSeries.getDeleteDirectoryNumbers().click();
        try 
        {
            numberSeries.deleteAnyNumberSeries(driver, numberSeries, read.getData(2, 3));
        } catch (InterruptedException e) 
        {
            e.printStackTrace();
        }
    }   

    @Test(priority=3,groups="smoke")
    public void deletingIndividualOperatorNumbers()
    {
        slp = new SNM_Login_Page(driver);
        smp = new SNM_Main_Page(driver);
        numberPlan = new NumberPlan(driver);
        numAnalysisPage = new Number_Analysis_Page(driver);
        numberSeries = new NumberSeries(driver);
        login.loginToSNM(slp, read, 1, 2, 3);
        read.fetchExcelData("Number_Series", excelPath);
        smp.getNumber_Analysis().click();
        numAnalysisPage.getNumber_Plan_Link().click();
        numberPlan.getNumberSeries().click();
        numberSeries = new NumberSeries(driver);
        new SelectDropDownValue().selectByIndex(numberSeries.getNumberSeriesDropDown(), read.getData(3, 4));
        numberSeries.getNumberSeriesViewButton().click();
        //numberSeries.getDeleteDirectoryNumbers().click();
        try 
        {
            numberSeries.deleteAnyNumberSeries(driver, numberSeries, read.getData(3, 3));
        } catch (InterruptedException e) 
        {
            e.printStackTrace();
        }
    }   

    @Test(priority=4)
    public void deletingCommonAbbreviatedNumbers()
    {
        slp = new SNM_Login_Page(driver);
        smp = new SNM_Main_Page(driver);
        numberPlan = new NumberPlan(driver);
        numAnalysisPage = new Number_Analysis_Page(driver);
        numberSeries = new NumberSeries(driver);
        login.loginToSNM(slp, read, 1, 2, 3);
        read.fetchExcelData("Number_Series", excelPath);
        smp.getNumber_Analysis().click();
        numAnalysisPage.getNumber_Plan_Link().click();
        numberPlan.getNumberSeries().click();
        numberSeries = new NumberSeries(driver);
        new SelectDropDownValue().selectByIndex(numberSeries.getNumberSeriesDropDown(), read.getData(4, 4));
        numberSeries.getNumberSeriesViewButton().click();
        //numberSeries.getDeleteDirectoryNumbers().click();
        try 
        {
            numberSeries.deleteAnyNumberSeries(driver, numberSeries, read.getData(4, 3));
        } catch (InterruptedException e) 
        {
            e.printStackTrace();
        }
    }   

    @Test(priority=5,groups= {"regression", "smoke"})
    public void deletingEmergencyOperatorToNumbers()
    {
        slp = new SNM_Login_Page(driver);
        smp = new SNM_Main_Page(driver);
        numberPlan = new NumberPlan(driver);
        numAnalysisPage = new Number_Analysis_Page(driver);
        numberSeries = new NumberSeries(driver);
        login.loginToSNM(slp, read, 1, 2, 3);
        read.fetchExcelData("Number_Series", excelPath);
        smp.getNumber_Analysis().click();
        numAnalysisPage.getNumber_Plan_Link().click();
        numberPlan.getNumberSeries().click();
        numberSeries = new NumberSeries(driver);
        new SelectDropDownValue().selectByIndex(numberSeries.getNumberSeriesDropDown(),read.getData(5, 4));
        numberSeries.getNumberSeriesViewButton().click();
        //numberSeries.getDeleteDirectoryNumbers().click();
        try 
        {
            numberSeries.deleteAnyNumberSeries(driver, numberSeries, read.getData(5, 3));
        } catch (InterruptedException e) 
        {
            e.printStackTrace();
        }
    }   

    @Test(priority=6)
    public void deletingIndividualAbbreviatedNumbers()
    {
        slp = new SNM_Login_Page(driver);
        smp = new SNM_Main_Page(driver);
        numberPlan = new NumberPlan(driver);
        numAnalysisPage = new Number_Analysis_Page(driver);
        numberSeries = new NumberSeries(driver);
        login.loginToSNM(slp, read, 1, 2, 3);
        read.fetchExcelData("Number_Series", excelPath);
        smp.getNumber_Analysis().click();
        numAnalysisPage.getNumber_Plan_Link().click();
        numberPlan.getNumberSeries().click();
        numberSeries = new NumberSeries(driver);
        new SelectDropDownValue().selectByIndex(numberSeries.getNumberSeriesDropDown(), read.getData(6, 4));
        numberSeries.getNumberSeriesViewButton().click();
        //numberSeries.getDeleteDirectoryNumbers().click();
        try 
        {
            numberSeries.deleteAnyNumberSeries(driver, numberSeries, read.getData(6, 3));
        } catch (InterruptedException e) 
        {
            e.printStackTrace();
        }
    }   

    @Test(priority=7)
    public void deletingRouteDirectoryNumbers()
    {
        slp = new SNM_Login_Page(driver);
        smp = new SNM_Main_Page(driver);
        numberPlan = new NumberPlan(driver);
        numAnalysisPage = new Number_Analysis_Page(driver);
        numberSeries = new NumberSeries(driver);
        login.loginToSNM(slp, read, 1, 2, 3);
        read.fetchExcelData("Number_Series", excelPath);
        smp.getNumber_Analysis().click();
        numAnalysisPage.getNumber_Plan_Link().click();
        numberPlan.getNumberSeries().click();
        numberSeries = new NumberSeries(driver);
        new SelectDropDownValue().selectByIndex(numberSeries.getNumberSeriesDropDown(), read.getData(7, 4));
        numberSeries.getNumberSeriesViewButton().click();
        //numberSeries.getDeleteDirectoryNumbers().click();
        try 
        {
            numberSeries.deleteAnyNumberSeries(driver, numberSeries, read.getData(7, 3));
        } catch (InterruptedException e) 
        {
            e.printStackTrace();
        }
    }   

    @Test(priority=8)
    public void deletingDialedNumberInformationService()
    {
        slp = new SNM_Login_Page(driver);
        smp = new SNM_Main_Page(driver);
        numberPlan = new NumberPlan(driver);
        numAnalysisPage = new Number_Analysis_Page(driver);
        numberSeries = new NumberSeries(driver);
        login.loginToSNM(slp, read, 1, 2, 3);
        read.fetchExcelData("Number_Series", excelPath);
        smp.getNumber_Analysis().click();
        numAnalysisPage.getNumber_Plan_Link().click();
        numberPlan.getNumberSeries().click();
        numberSeries = new NumberSeries(driver);
        new SelectDropDownValue().selectByIndex(numberSeries.getNumberSeriesDropDown(), read.getData(8, 4));
        numberSeries.getNumberSeriesViewButton().click();
        //numberSeries.getDeleteDirectoryNumbers().click();
        try 
        {
            numberSeries.deleteAnyNumberSeries(driver, numberSeries, read.getData(8, 3));
        } catch (InterruptedException e) 
        {
            e.printStackTrace();
        }
    }   

    @Test(priority=9)
    public void deletingPagingNumbers()
    {
        slp = new SNM_Login_Page(driver);
        smp = new SNM_Main_Page(driver);
        numberPlan = new NumberPlan(driver);
        numAnalysisPage = new Number_Analysis_Page(driver);
        numberSeries = new NumberSeries(driver);
        login.loginToSNM(slp, read, 1, 2, 3);
        read.fetchExcelData("Number_Series", excelPath);
        smp.getNumber_Analysis().click();
        numAnalysisPage.getNumber_Plan_Link().click();
        numberPlan.getNumberSeries().click();
        numberSeries = new NumberSeries(driver);
        new SelectDropDownValue().selectByIndex(numberSeries.getNumberSeriesDropDown(), read.getData(9, 4));
        numberSeries.getNumberSeriesViewButton().click();
        //numberSeries.getDeleteDirectoryNumbers().click();
        try 
        {
            numberSeries.deleteAnyNumberSeries(driver, numberSeries, read.getData(9, 3));
        } catch (InterruptedException e) 
        {
            e.printStackTrace();
        }
    }   

    @Test(priority=10)
    public void deletingGatewayRoutingNumbers()
    {
        slp = new SNM_Login_Page(driver);
        smp = new SNM_Main_Page(driver);
        numberPlan = new NumberPlan(driver);
        numAnalysisPage = new Number_Analysis_Page(driver);
        numberSeries = new NumberSeries(driver);
        login.loginToSNM(slp, read, 1, 2, 3);
        read.fetchExcelData("Number_Series", excelPath);
        smp.getNumber_Analysis().click();
        numAnalysisPage.getNumber_Plan_Link().click();
        numberPlan.getNumberSeries().click();
        numberSeries = new NumberSeries(driver);
        new SelectDropDownValue().selectByIndex(numberSeries.getNumberSeriesDropDown(), read.getData(10, 4));
        numberSeries.getNumberSeriesViewButton().click();
        //numberSeries.getDeleteDirectoryNumbers().click();
        try 
        {
            numberSeries.deleteAnyNumberSeries(driver, numberSeries, read.getData(10, 3));
        } catch (InterruptedException e) 
        {
            e.printStackTrace();
        }
    }   
}
package com.snm.test;

import java.util.Set;

import org.openqa.selenium.By;
import org.testng.Assert;
import org.testng.Reporter;
import org.testng.annotations.Test;

import com.pmsnm.Utilities.NavigateToLocation;
import com.pmsnm.Utilities.SNM_Login;
import com.pmsnm.baseTest.BasePageSNM;
import com.snm.pageObjects.NumberPlan;
import com.snm.pageObjects.NumberSeries;
import com.snm.pageObjects.Number_Analysis_Page;
import com.snm.pageObjects.SNM_Login_Page;
import com.snm.pageObjects.SNM_Main_Page;
import com.snm.pageObjects.ToolsPage;

public class InternalDirectoryNumbers extends BasePageSNM
{
    Number_Analysis_Page numAnalysisPage;
    NumberPlan numberPlan;
    NumberSeries numberSeries;
    ToolsPage tpage;
    SNM_Login_Page slp;
    SNM_Main_Page smp;
    NavigateToLocation navigate;

    @Test(priority=11,groups={"regression", "smoke"})
    public void createDirectoryNumbers()
    {
        numberSeries = new NumberSeries(driver);
        numberPlan = new NumberPlan(driver);
        numAnalysisPage = new Number_Analysis_Page(driver);
        slp = new SNM_Login_Page(driver);
        smp = new SNM_Main_Page(driver);
        login.loginToSNM(slp, read, 1,2,3);
        NavigateToLocation navigate = new NavigateToLocation();
        navigate.navigateToInternalNumSeriesPage(smp, numAnalysisPage, numberPlan, numberSeries, driver);
        read.fetchExcelData("Number_Series", excelPath);
        numberSeries.setDirectoryNumbersTextBox(read.getData(1, 1));
        numberSeries.getApplyButton().click();
        Assert.assertEquals(numberSeries.getSuccessMessage().getText().trim(), "Add operation successful for:");    
    }

    @Test(priority=12,groups="smoke")
    public void createCommonOperatorNumbers()
    {
        numberSeries = new NumberSeries(driver);
        numberPlan = new NumberPlan(driver);
        numAnalysisPage = new Number_Analysis_Page(driver);
        slp = new SNM_Login_Page(driver);
        smp = new SNM_Main_Page(driver);
        login.loginToSNM(slp, read, 1,2,3);
        NavigateToLocation navigate = new NavigateToLocation();
        navigate.navigateToInternalNumSeriesPage(smp, numAnalysisPage, numberPlan, numberSeries, driver);
        read.fetchExcelData("Number_Series", excelPath);
        numberSeries.setCommonOperatorNumbers(read.getData(2, 1));
        numberSeries.getApplyButton().click();
        Assert.assertEquals(numberSeries.getSuccessMessage().getText().trim(), "Add operation successful for:");
    }

    @Test(priority=13,groups="regression")
    public void createIndividualOperatorNumbers()
    {
        numberSeries = new NumberSeries(driver);
        numberPlan = new NumberPlan(driver);
        numAnalysisPage = new Number_Analysis_Page(driver);
        slp = new SNM_Login_Page(driver);
        smp = new SNM_Main_Page(driver);
        login.loginToSNM(slp, read, 1,2,3);
        NavigateToLocation navigate = new NavigateToLocation();
        navigate.navigateToInternalNumSeriesPage(smp, numAnalysisPage, numberPlan, numberSeries, driver);
        read.fetchExcelData("Number_Series", excelPath);
        numberSeries.setIndividualOperatorNumbers(read.getData(3, 1));
        numberSeries.getApplyButton().click();
        Assert.assertEquals(numberSeries.getSuccessMessage().getText().trim(), "Add operation successful for:");
    }

    @Test(priority=14,groups="regression")
    public void createCommonAbbreviatedNumbers()
    {
        numberSeries = new NumberSeries(driver);
        numberPlan = new NumberPlan(driver);
        numAnalysisPage = new Number_Analysis_Page(driver);
        slp = new SNM_Login_Page(driver);
        smp = new SNM_Main_Page(driver);
        login.loginToSNM(slp, read, 1,2,3);
        NavigateToLocation navigate = new NavigateToLocation();
        navigate.navigateToInternalNumSeriesPage(smp, numAnalysisPage, numberPlan, numberSeries, driver);
        read.fetchExcelData("Number_Series", excelPath);
        numberSeries.setCommonAbbreviatedNumbers(read.getData(4, 1));
        numberSeries.getApplyButton().click();
        Assert.assertEquals(numberSeries.getSuccessMessage().getText().trim(), "Add operation successful for:");
    }

    @Test(priority=15,groups="smoke")
    public void createEmergencyNumbersOperator()
    {
        numberSeries = new NumberSeries(driver);
        numberPlan = new NumberPlan(driver);
        numAnalysisPage = new Number_Analysis_Page(driver);
        slp = new SNM_Login_Page(driver);
        smp = new SNM_Main_Page(driver);
        login.loginToSNM(slp, read, 1,2,3);
        NavigateToLocation navigate = new NavigateToLocation();
        navigate.navigateToInternalNumSeriesPage(smp, numAnalysisPage, numberPlan, numberSeries, driver);
        read.fetchExcelData("Number_Series", excelPath);
        numberSeries.getAdvanceButton().click();
        numberSeries.setEmergencyNumberToOperator(read.getData(5, 1));
        numberSeries.getApplyButton().click();
        Assert.assertEquals(numberSeries.getSuccessMessage().getText().trim(), "Add operation successful for:");
    }

    @Test(priority=16,groups="regression")
    public void createIndividualAbbreviatedNumbers()
    {
        numberSeries = new NumberSeries(driver);
        numberPlan = new NumberPlan(driver);
        numAnalysisPage = new Number_Analysis_Page(driver);
        slp = new SNM_Login_Page(driver);
        smp = new SNM_Main_Page(driver);
        login.loginToSNM(slp, read, 1,2,3);
        NavigateToLocation navigate = new NavigateToLocation();
        navigate.navigateToInternalNumSeriesPage(smp, numAnalysisPage, numberPlan, numberSeries, driver);
        read.fetchExcelData("Number_Series", excelPath);
        numberSeries.getAdvanceButton().click();
        numberSeries.setIndividualAbbreviatedNumbers(read.getData(6, 1));
        numberSeries.getApplyButton().click();
        Assert.assertEquals(numberSeries.getSuccessMessage().getText().trim(), "Add operation successful for:");
    }

    @Test(priority=17,groups="smoke")
    public void createRouteDirectoryNumbers()
    {
        numberSeries = new NumberSeries(driver);
        numberPlan = new NumberPlan(driver);
        numAnalysisPage = new Number_Analysis_Page(driver);
        slp = new SNM_Login_Page(driver);
        smp = new SNM_Main_Page(driver);
        login.loginToSNM(slp, read, 1,2,3);
        NavigateToLocation navigate = new NavigateToLocation();
        navigate.navigateToInternalNumSeriesPage(smp, numAnalysisPage, numberPlan, numberSeries, driver);
        read.fetchExcelData("Number_Series", excelPath);
        numberSeries.getAdvanceButton().click();
        numberSeries.setRouteDirectoryNumbers(read.getData(7, 1));
        numberSeries.getApplyButton().click();
        Assert.assertEquals(numberSeries.getSuccessMessage().getText().trim(), "Add operation successful for:");
    }

    @Test(priority=18,groups="regression")
    public void createDialedNumberInformationService()
    {
        numberSeries = new NumberSeries(driver);
        numberPlan = new NumberPlan(driver);
        numAnalysisPage = new Number_Analysis_Page(driver);
        slp = new SNM_Login_Page(driver);
        smp = new SNM_Main_Page(driver);
        login.loginToSNM(slp, read, 1,2,3);
        NavigateToLocation navigate = new NavigateToLocation();
        navigate.navigateToInternalNumSeriesPage(smp, numAnalysisPage, numberPlan, numberSeries, driver);
        read.fetchExcelData("Number_Series", excelPath);
        numberSeries.getAdvanceButton().click();
        numberSeries.setDialedNumberInfoService(read.getData(8, 1));
        numberSeries.getApplyButton().click();
        Assert.assertEquals(numberSeries.getSuccessMessage().getText().trim(), "Add operation successful for:");
    }

    @Test(priority=19,groups="regression")
    public void createPagingNumbers()
    {
        numberSeries = new NumberSeries(driver);
        numberPlan = new NumberPlan(driver);
        numAnalysisPage = new Number_Analysis_Page(driver);
        slp = new SNM_Login_Page(driver);
        smp = new SNM_Main_Page(driver);
        login.loginToSNM(slp, read, 1,2,3);
        NavigateToLocation navigate = new NavigateToLocation();
        navigate.navigateToInternalNumSeriesPage(smp, numAnalysisPage, numberPlan, numberSeries, driver);
        read.fetchExcelData("Number_Series", excelPath);
        numberSeries.getAdvanceButton().click();
        numberSeries.setPagingNumbers(read.getData(9, 1));
        numberSeries.getApplyButton().click();
        Assert.assertEquals(numberSeries.getSuccessMessage().getText().trim(), "Add operation successful for:");
    }

    @Test(priority=20,groups="smoke")
    public void createGatewayRoutingNumbers() throws InterruptedException
    {
        String CLI = "Command Line Interface";
        numberSeries = new NumberSeries(driver);
        numberPlan = new NumberPlan(driver);
        numAnalysisPage = new Number_Analysis_Page(driver);
        slp = new SNM_Login_Page(driver);
        smp = new SNM_Main_Page(driver);
        login.loginToSNM(slp, read, 1,2,3);
        read.fetchExcelData("Number_Series", excelPath);
        smp.getTools().click();     
        tpage = new ToolsPage(driver);
        tpage.getCommandLine().click();
        String parentWindow = driver.getWindowHandle();
        Set<String> window = driver.getWindowHandles();
        for(String newWindow : window)
        {
                driver.switchTo().window(newWindow);
                if(driver.getTitle().equals(CLI))
                {
                    System.out.println(driver.getTitle());
                    driver.manage().window().maximize();
                    System.out.println("Entered CLI Window");
                    driver.switchTo().frame("CommandLine");
                    tpage.getCommandField().sendKeys(read.getData(10, 2));
                    tpage.getCmdApply().click();
                    driver.close();
                }
        }
        driver.switchTo().window(parentWindow);     
        smp.getNumber_Analysis().click();
        NavigateToLocation navigate = new NavigateToLocation();
        navigate.navigateToInternalNumSeriesPage(smp, numAnalysisPage, numberPlan, numberSeries, driver);
        numberSeries.getAdvanceButton().click();
        numberSeries.setGatewayRoutingNumbers(read.getData(10, 1));
        numberSeries.getApplyButton().click();
        Assert.assertEquals(numberSeries.getSuccessMessage().getText().trim(), "Add operation successful for:");
    }


}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite">
  <test thread-count="1" name="Firefox_Test"  preserve-order="true">
  <!-- <groups>
  <run>
  <include name="smoke"/>
  </run>
  </groups> -->
    <classes>
      <class name="com.snm.test.DeletingInternalNumberSeries"/>
      <class name="com.snm.test.InternalDirectoryNumbers"/>
    </classes>
  </test> 

  <!-- <test thread-count="5" name="Chrome_Test">
  <parameter name="browser" value="chrome" />
    <classes>
      <class name="com.snm.test.DeletingInternalNumberSeries"/>
      <class name="com.snm.test.InternalDirectoryNumbers"/>
    </classes>
  </test>  -->
  <!-- Test -->
</suite> <!-- Suite -->

1 个答案:

答案 0 :(得分:0)

尝试在testng.xml文件的suite参数中添加parallel="classes"
例如:
<suite name="Suite" parallel="classes">