作为 TestNG 套件运行在 Eclipse 中不起作用 [英] Run as TestNG Suite not working in eclipse

查看:33
本文介绍了作为 TestNG 套件运行在 Eclipse 中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习 TestNG 并致力于参数化.我创建了一个新的 java 类,然后创建了一个新的 testng.xml 文件.我在 xml 文件中包含了类名.但我尝试将 testNG.xml 文件作为 TestNG Suite 运行,但没有任何效果.

I am learning TestNG and working on parameterization. I created a new java class and then I created a new testng.xml file. I included the class name in the xml file. But I tried to run the testNG.xml file as TestNG Suite nothing will work.

请看java类,

 public class Test1 {

 @Test
 public void test_Firefox()
 {
    System.out.println("Test_Firefox method..");
 }
}

Testng.xml 文件,

Testng.xml file,

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >

<suite name="Suite1" verbose="1" >
 <test name="Test" >
   <classes>
      <class name="com.multibrowser.Test1" />
   </classes>
 </test>
</suite>

文件夹结构,

请帮我解决这个问题.

推荐答案

不确定你为什么在参考库"下创建套件文件

Not sure Why did you created your suite file under "Referenced Libraries"

在com.multibrowser"包下创建它.或在另一个文件夹下.

create it under "com.multibrowser" package. or under another folder.

看看下面的截图,testng-suite.xml.

take a look at screenshot below, testng-suite.xml.

右键单击您的套件文件,单击运行方式 -> 运行配置.你会像下面这样,

Right click your suite file, click Run as -> Run Configurations. you will some thing like below,

右键单击 testng 并提供新的,然后根据屏幕截图选择您的套件并运行.

Right Click testng and give new, Then choose your suite and give run, as per screenshot.

这篇关于作为 TestNG 套件运行在 Eclipse 中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆