Monday, April 20, 2020

TestNG Tutorial Advanced Topics - Part 1

We are now going to learn more advance stuff about the TestNG in this tutorials.

In first tutorial of TestNG (Introduction of TestNG), you get enough knowledge how to install, configure and different annotations.


Default Project Folder Structure With TestNG Library





Let's see the difference on JAVA class and TestNG class.


Below is difference in Option when you try to run the Java Class and TestNG Class.


TestNG Class: Similar to Java class but dont contains Main Method and contains different annotations to run as testng class.



Note: We never use Main Method in TestNG Class.


Java Class Run





TestNG Class Run






How TestNG Change the Reporting in Selenium: Main Benefits of TestNG

Without TestNG: In Selenium without TestNG we have to add required PRINT LINE statements to verify that we are on right track or not or we need to print same information back and forth to excel or other files.


Without TestNG - When we run the Selenium Script, we can see output in Console.





With TestNG - We can see the complete format of how many test case run, pass, failed and skipped.




Also one separate folder 'test-output' get generated every time we run TestNG class and it has different kind of reports. 




Mostly used format is 'Index.html' which display below structure in browser.


No comments:

Post a Comment