This blog is for Automation Test Engineers

Thursday 15 March 2018

How to execute first TestNG class


1)   Select the Java project in the Eclipse and go to Run | Run Configuration.Run Configurations window will be opened.




1)   Select TestNG in the given options and select a New_configuration.



3) Please notice that TestNG plugin provides multiple options for running your test cases as follows:
·         Class: Using this option you can provide the class name along with the package to run only the said specific test class.
·         Method: Using this you can run only a specific method in a test class.
·         Groups: In case you would like to run specific test methods belonging to a particular TestNG group, you can enter those here for executing them.
·         Package: If you would like to execute all the tests inside a package, you can specify these in this box.
·         Suite: In case you have suite files in the form of testing.xml files, you can select those here for execution.
Let’s enter the configuration name as TestNGRunConfig and select the newly created class under the Class section and click on Apply.
4) Now if you would like to run the newly created configuration, just click on Run after clicking on Apply. This will compile and run the TestNG test class that we have written. The result of the test execution is displayed in the Console and Results windows of Eclipse as shown in the following screenshot.

TestNg Results window




  
  1)TestNG also produce HTML reports. To access those reports go to the  Project directory and open test-output folder

   2)Open emailable-report.html, as this is a html report open it with browser.












0

0 comments:

Post a Comment