English version (11)-Eclipse plug-in for testng

Source: Internet
Author: User
Tags testng
Eclipse plug-in of testng

The Eclipse plug-in of testng allows you to easily run the testng test under eclipse and conveniently monitor its execution and output. It consists of its own project, see the project on code.google.com calledTestng-Eclipse.

4.1-Installation

Once the plug-in has been installed, restart eclipse and selectWindow/show view/other...Then you can see that the testng view is listed in the Java category.

4.2-create a testng running configuration

Once you have finished wearing a class with the testng annotation, and/or one or moreTestng. xmlFile, you can create a testng running configuration. SelectRun/run...(OrRun/debug...), And create a new testng Configuration:

You can clickBrowse...Button.

Then you can run the testng test as follows:

4.2.1-file by class

Note thatClassCheck box nearby, and then select your class from the project. You can clickBrowse...Button, and then directly select from the list. This list only contains classes with testng Annotations:

4.2.2-by group

If you want to run one or more groups, you can enter them in the text box or pressBrowse...Select from the button:

4.2.3-according to the definition file

Finally, you can select a test definition file for the project. This file does not have to be clearly namedTestng. XML, the plug-in automatically identifies all the testng XML files in your project:

4.2.4-methods

In this case, it cannot be completed directly from the running dialog box, but can be completed directly from the Outline View:

You can right-click any test method and selectRun as.../testng TestAnd only the selected method will be run (this is not in the middle, because I did not find a way to bring up the menu ).

Running the test by method can also be called from the package browser, of course, in the Java browser view.

Once you select one of the preceding methods, you can also select the Log Level and check whether testng runs in 1.4 or 1.5 mode. Then you can pressDebug(OrRun. At this time, you will be switched to the debug view, and the main view of testng will be opened.

4.3-view test results

Displays a set of successfully running tests: the progress bar is green and no failure reports are displayed.All testsThe label displays a list of all the methods and classes you have run.

If your operation fails, the view will look like this:

You can useFailed testsLabel to show only failed tests, so that you can select one of them and view the stack Information on the right. You can also directly double-click one of those items in the stack information (original article: offending line) to directly jump to your code.

4.4-test the conversion from JUnit

When you edit the JUnit test class, press the Ctrl-1 (quick fix) and the plug-in will convert you to the testng option. You can use the JDK 5 annotation:

You can also use the javadoc annotation:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.