Java 无法按XML文件运行所有TestNg脚本

Java 无法按XML文件运行所有TestNg脚本,java,selenium,testng,Java,Selenium,Testng,我试图在单击TestNG.xml文件时运行3个JavaTestNG类,但只有第一个类在运行。下面文件的其余部分未在testng.xml下运行 下面是testng.xml文件 <suite name="AutomationSuite" parallel="none"> <test name="simple"> <classes> <class name="Script.OpenAccount"/> <

我试图在单击TestNG.xml文件时运行3个JavaTestNG类,但只有第一个类在运行。下面文件的其余部分未在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> 
下面是我的测试课

@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();
        }
@测试
public void f()引发InterruptedException{
LoginCRM log=新的LoginCRM(驱动程序);
log.login();
System.out.println(“登录完成”);
WebDriverWait wait1=新的WebDriverWait(驱动程序,50);
wait1.until(ExpectedConditions.presenceOfElementLocated(By.xpath(//nobr[text()='Service']));
System.out.println(“点击服务”);
Dashboard_POM dashobj=新仪表板_POM(驾驶员);
dashobj.clk_act();
System.out.println(“点击账户”);
driver.switchTo().frame(“contentIFrame”);
睡眠(5000);
尝试
{
Acc_着陆页面_Pom obj1=新Acc_着陆页面_Pom(驾驶员);
obj1.rec_open();
System.out.println(“账户页面已打开”);
}
捕获(例外e)
{
}
switch.switchWindow();
仪表板\u POM obj2=新仪表板\u POM(驾驶员);
设置allwhs=driver.getWindowHandles();
系统输出打印LN(所有WHS);
//睡眠(5000);
WebDriverWait wait2=新的WebDriverWait(驱动程序,50);
wait2.until(ExpectedConditions.presenceOfElementLocated(By.xpath(“./*[@id='account | norrelationship | Form | Mscrm.Form.account.Save Large']);
正在切换。backtomainWindow();
obj2.logout_btn();
}
下面是错误的屏幕截图

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

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   
Thread[main](挂起)
NativeMethodAccessorImpl.invoke0(方法、对象、对象[])行:不可用[本机方法]
NativeMethodAccessorImpl.invoke(对象,对象[])行:不可用
DelegatingMethodAccessorImpl.invoke(对象,对象[])行:不可用
调用(对象,对象…)行:不可用
调用方法(方法,对象,对象[])行:85
Invoker.invokeMethod(Object,ITestNGMethod,Object[],int,XmlSuite,Map,ITestClass,ITestNGMethod[],ITestNGMethod[],ConfigurationGroupMethods,FailureContext)行:639
invokeTestMethod(对象、ITestNGMethod、对象[]、int、XmlSuite、映射、ITestClass、ITestNGMethod[]、ITestNGMethod[]、ConfigurationGroupMethods、FailureContext)行:816
invokeTestMethods(ITestNGMethod、XmlSuite、Map、ConfigurationGroupMethods、Object、ITestContext)行:1124
TestMethodWorker.invokeTestMethods(ITestNGMethod,Object,ITestContext)行:125

您能为您的测试类提供源代码(至少是带有注释、方法签名等的大纲)吗?@mfulton26:我已经编辑了这个问题,并向您提供了测试类希望脚本是您的包名,如果是,您提供的“@”测试属于开放帐户,然后删除“@”在第二个测试用例中进行测试之前,您是否可以发布任何失败类的异常?不是从调试模式。
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