无法通过XML文件运行所有TestNg脚本

时间:2016-02-02 10:19:07

标签: java selenium testng

我试图在点击 testng.xml 文件时运行3个Java TestNG 类,但只有1st正在运行。其余文件未在 testng.xml 下运行 以下是 testng.xml 文件

<suite name="AutomationSuite" parallel="none">

  <test name="simple">

    <classes>
      <class name="Script.OpenAccount"/>
        <class name="Script.openContact"/>
         <class name="Script.Open_Case"/>
        </classes>
      </test>

  </suite> 

以下是driverInstance文件,我打开我的FF浏览器并输入链接

public class DriverInstance {
    public static WebDriver driver;

  @BeforeTest
  public void beforeTest() {
  driver = new FirefoxDriver();

      driver.navigate().to("https://ppmss360.ford.qa.ams.hpmsdynamics.com");
      driver.manage().window().maximize();
  }

  @AfterTest
  public void afterTest() {
  //driver.close();
  }

以下是我的测试类

@Test
  public void f() throws InterruptedException {
      LoginCRM log = new LoginCRM(driver);
      log.login();
      System.out.println("login is done");
      WebDriverWait wait1 = new WebDriverWait(driver,50);
        wait1.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//nobr[text()='Service']")));
        System.out.println("clicked on service");


      Dashboard_POM dashobj = new Dashboard_POM(driver);
      dashobj.clk_act();
      System.out.println("clicked on account");

      driver.switchTo().frame("contentIFrame");
        Thread.sleep(5000);
        try
        {
            Acc_landingPage_Pom obj1 = new Acc_landingPage_Pom(driver);
            obj1.rec_open();
            System.out.println("account page is opened");
        }
        catch(Exception e)
        {

        }

        Switching.switchWindow();
        Dashboard_POM obj2 = new Dashboard_POM(driver);
    Set<String> allwhs = driver.getWindowHandles();
    System.out.println(allwhs);


    //Thread.sleep(5000);
    WebDriverWait wait2 = new WebDriverWait(driver, 50);
    wait2.until(ExpectedConditions.presenceOfElementLocated(By.xpath(".//*[@id='account|NoRelationship|Form|Mscrm.Form.account.Save-Large']")));
    Switching.backtomainWindow();
        obj2.logout_btn();
        }

以下是错误enter image description here

的屏幕截图

以下是调试模式窗口中的方法

Thread [main] (Suspended)   
    <obsolete method in<unknown declaring type>>    
    NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]  
    NativeMethodAccessorImpl.invoke(Object, Object[]) line: not available   
    DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: not available   
    Method.invoke(Object, Object...) line: not available    
    MethodInvocationHelper.invokeMethod(Method, Object, Object[]) line: 85  
    Invoker.invokeMethod(Object, ITestNGMethod, Object[], int, XmlSuite, Map<String,String>, ITestClass, ITestNGMethod[], ITestNGMethod[], ConfigurationGroupMethods, FailureContext) line: 639 
    Invoker.invokeTestMethod(Object, ITestNGMethod, Object[], int, XmlSuite, Map<String,String>, ITestClass, ITestNGMethod[], ITestNGMethod[], ConfigurationGroupMethods, FailureContext) line: 816 
    Invoker.invokeTestMethods(ITestNGMethod, XmlSuite, Map<String,String>, ConfigurationGroupMethods, Object, ITestContext) line: 1124  
    TestMethodWorker.invokeTestMethods(ITestNGMethod, Object, ITestContext) line: 125   

0 个答案:

没有答案