问题描述
我是TestNG和Selenium Webdriver的新手,并尝试使用eclipse创建一个testng.xml。
I am new to TestNG and Selenium Webdriver and trying to create a testng.xml using eclipse.
在www中进行一些研究,并了解该文件可以被创建通过做右键点击Java类>> TestNG >>转换为TestNG
Done some research in www and understand that this file can be created by doing Right Click on the Java class >> TestNG >> Convert to TestNG
但是这个Convert Refactoring向导没有打开。
However this Convert Refactoring wizard is not opening.
如果Java类已经包含@Test注释(!?),这个向导是否不会打开。
Whether this wizard will not open, if the Java class already contains @Test annotations (!?)
可以帮助我创建testng.xml吗eclipse请。
Can you help me to create testng.xml using eclipse please.
(我正在使用Eclipse Luna)
(I am using Eclipse Luna)
推荐答案
手动创建testng套件文件如下:
Created testng suite file manually as below:
- 运行一次您的项目
- 刷新您的项目
-
- 现在,test-output文件夹将在您的项目下创建 - 展开文件夹
- 双击index.html文件;它将在Eclipse浏览器窗口中打开
- 单击左侧面板上给出的.xml链接
- 测试套件XML将获得在右侧面板上打开
- 获取XML内容的副本
- 右键单击您的项目>>新建>>文件
- 提供测试套件文件的名称(with.xml扩展名,例如testng.xml),然后单击完成
- 将您从index.html复制的内容粘贴'并根据您的需要修改您的套件文件
- Run once your project
- Refresh your project
- Now, "test-output" folder will get created under your project – unfold the folder
- Double click the ‘index.html’ file; it will get open in the Eclipse Browser window
- Click on the ‘.xml’ link given on the left panel
- The test suite XML will get opened on the right-side panel
- Take a copy of the XML content
- Right click your project >> New >> File
- Give name of your test suite file (with.xml extension e.g. testng.xml) and click finish
- Paste the content that you copied from the ‘index.html’ and amend your suite file as per your needs
这篇关于如何使用Eclipse创建'testng.xml'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!