Once you have installed the plug-in, restart Eclipse and select the menu Window / Show View / Other... and you should see the TestNG view listed in the Java category.
Once you have created classes that contain TestNG annotations and/or one or more testng.xml files, you can create a TestNG Launch Configuration. Select the Run / Run... (or Run / Debug...) menu and create a new TestNG configuration:
You should change the name of this configuration and pick a project, which can be selected by clicking on the Browse... button at the top of the window.
Then you choose to launch your TestNG tests in the following ways:
Make sure the box near Class is checked and then pick a class from your project. You can click on the Browse... button and pick it directly from a list. This list only contains classes that contain TestNG annotations:
If you only want to launch one or several groups, you can type them in the text field or pick them from a list by clicking on the Browse... button
Finally, you can select a suite definition from your project. It doesn't have to be named testng.xml, the plug-in will automatically identify all the applicable TestNG XML files in your project:
This launch isn't accomplished from the Launch dialog but directly from your Outline view:
You can right-click on any test methods and select Run as... / TestNG test and only the selected method will be run (not shown on the above screenshot because I couldn't find a way to capture a contextual menu).
Method launching is also available from the Package Explorer view and from the Java Browser perspective.
Once you have selected one of these launches, you can also choose the logging of level and also whether TestNG should run in 1.4 or 1.5 mode. Then you can launch the tests by pressing the Debug (or Run) button, which will switch you to the Debug perspective and will open the main TestNG view.
The above view shows a successful run of the tests: the bar is green and no failed tests are reported. The All tests tab shows you a list of all the classes and methods that were run.
If your test run contains failures, the view will look like this:
You can use the Failed tests tab to display only these tests that failed, and when you select such a test, the stack trace will be shown on the right-hand pane. You can double click on the offending line to be taken directly to the failure in your code.
When you are editing a JUnit class, press Ctrl-1 (Quick Fix) and the plug-in will give you the option to convert it to TestNG, either with JDK5 annotations:
or JavaDoc annotations:
<noscript src="http://www.google-analytics.com/urchin.js" type="text/javascript"></noscript>
<noscript type="text/javascript"></noscript>
分享到:
相关推荐
它们通常包含一组相关的Java类,通过Eclipse的Plug-in Development Environment (PDE)工具进行开发。这些插件可以为开发者提供各种便利,例如代码编辑器、调试器、构建工具等。在Eclipse中,插件间的通信是通过Plug-...
TestNG P2 更新站点是针对Java开发者的一个重要资源,它提供了TestNG库的P2(Plug-in 2)格式更新。TestNG是一个流行的自动化测试框架,它在功能和性能测试方面有着广泛的应用,尤其在敏捷开发和持续集成环境中。P2...
如果你没有安装过任何其他插件,Eclipse的"Plug-ins"目录可能为空,这是正常的。 4. **定位Eclipse插件目录**: 通常,Eclipse的插件目录位于"Eclipse安装目录/plugins"下。如果你不确定,可以在Eclipse中选择“Help...
要开发Eclipse插件,首先需要了解Plug-in Development Environment(PDE)。PDE提供了一套工具,帮助开发者创建、调试和打包Eclipse插件。 1. 创建插件项目:通过“文件”->“新建”->“其他”->“Eclipse”->...
- Plug-in Development Environment (PDE):讲解Eclipse插件开发环境,如何创建、运行和调试插件。 - OSGi框架:介绍Eclipse基于OSGi的服务模型,理解模块化开发的优势。 - RCP(Rich Client Platform):讲解如何...
- **Plug-in机制**:Eclipse的可扩展性主要来自于其强大的插件系统。开发者可以通过编写插件来扩展Eclipse的功能,满足个性化需求。 - **OSGi框架**:Eclipse基于OSGi服务,这是一种模块化系统,允许插件动态加载...
1. **插件项目创建**:在Eclipse中,可以通过"File" -> "New" -> "Plug-in Project"来创建一个新的插件项目。这个过程会自动生成一些基础的项目结构和配置文件,如plugin.xml,它是定义插件元数据的关键文件。 2. *...
开发者通常会使用Plug-in Development Environment(PDE)工具集,它作为Eclipse的一部分,提供了创建、构建、调试和发布插件的完整工作流程。插件的开发涉及编写plugin.xml文件来定义插件元数据,创建Java类来实现...
了解插件开发基础,如Plug-in Development Environment (PDE) 的使用。 - **流行插件应用**:探讨如Mylyn(任务管理)、Subversive(SVN集成)、Git Team Provider(Git集成)等常用插件的安装与使用。 3. **构建...
开发者可以通过学习Eclipse插件API(比如JFace和SWT)来创建自定义的用户界面,或者使用PDE(Plug-in Development Environment)工具来开发、调试和打包插件。此外,掌握Eclipse的模型驱动开发(MDD)概念,如EMF...
10. **PDE(Plug-in Development Environment)**:Eclipse内建的PDE工具集为开发者提供了方便的插件开发环境,帮助他们轻松地创建、调试和发布自己的插件。 总的来说,Eclipse编辑器以其强大而灵活的特性,成为了...
3. **PDE(Plug-in Development Environment)**:Eclipse提供的用于开发和调试插件的工具集。 4. **Eclipse RCP(Rich Client Platform)**:基于Eclipse构建桌面应用的框架。 为了充分利用eclipseYachi,开发者...