TestNG Eclipse plugin helps us in creating TestNG classes easily and executing them. Let’s see how to install “TestNG for Eclipse” plugin in Eclipse IDE.
TestNG Eclipse插件帮助我们轻松创建TestNG类并执行它们。 让我们看看如何在Eclipse IDE中安装“ TestNG for Eclipse”插件。
TestNG Eclipse插件 (TestNG Eclipse Plugin)
- Open Eclipse and go to Help | Eclipse Marketplace. Then search for “TestNG”. You should get following result.帮助| Eclipse市场 。 然后搜索“ TestNG”。 您应该得到以下结果。
- Click on Install and next window will show TestNG features to install. Select all of them and click on Continue button.
- In the next screen, accept the license agreement and click on Finish button.
- Eclipse will show the warning that you are installing software that contains unsigned content. Click on “Install Anway” button.
- After installation is finished, Eclipse will ask you to restart so that TestNG Eclipse plugin is available to use. Click on “Restart Now” to restart Eclipse and start using the TestNG plugin.
用于Eclipse安装验证的TestNG (TestNG for Eclipse Installation Verification)
After Eclipse is restarted, go to New | Other. The wizard window will open up and you should see option to create a TestNG class.
重新启动Eclipse之后,转到New | 其他 。 向导窗口将打开,您将看到创建TestNG类的选项。
If you get above option, then it means that TestNG Eclipse plugin has been installed successfully.
如果您获得上述选项,则表明TestNG Eclipse插件已成功安装。
TestNG Eclipse教程 (TestNG Eclipse Tutorial)
You can go through TestNG Tutorial to learn how to create TestNG tests using TestNG for Eclipse plugin.
您可以通过TestNG教程来学习如何使用TestNG for Eclipse插件创建TestNG测试。
TestNG Eclipse运行配置 (TestNG Eclipse Run Configuration)
We can create TestNG classes run configuration so that we don’t have to find the test class and run it as TestNG test.
我们可以创建TestNG类运行配置,这样我们就不必找到测试类并将其作为TestNG测试运行。
Let’s see how easily we can create an Eclipse TestNG Run Configuration.
让我们看看我们如何轻松地创建Eclipse TestNG运行配置。
Open the TestNG test class and go to Run As | Run Configurations.
打开TestNG测试类并转到“运行方式| 运行配置 。
Click on the + button as shown in the below image.
单击+按钮,如下图所示。
In the configuration screen, provide a descriptive name for the configuration. Browse for the project and select the class as shown in the below image.
在配置屏幕中,为配置提供一个描述性名称。 浏览项目,然后选择类,如下图所示。
Click on “Apply” button to save the configuration. You can then click on “Run” button to run the configuration, which will run the TestNG test class.
单击“应用”按钮以保存配置。 然后,您可以单击“运行”按钮运行配置,这将运行TestNG测试类。
You can go to Run | Run Configurations and select the predefined configuration to run the TestNG test class.
您可以转到运行| 运行配置并选择预定义的配置以运行TestNG测试类。
That’s all for a quick tutorial on using Eclipse TestNG plugin.
这就是有关使用Eclipse TestNG插件的快速教程的全部内容。