JUnit vs TestNG

JUnit vs TestNG
February 21 06:24 2017 Print This Article

Usually, in order to conduct thorough and detailed software testing, specialists use special tools and frameworks. It can be tools for automated testing or load testing, frameworks for system testing or acceptance testing, etc.

JUnit and TestNG frameworks used to perform unit testing of software products have some common features. First of all, they give testers the possibility to design the unit test cases. Besides that, JUnit and Test NG provide easy conduction of the timeout test.

Both frameworks ensure the creation of expected exception tests. Some annotations for both tools are similar (for example, @AfterClass, @Test, @BeforeClass). Testers are able to ignore the execution of some specific test cases within the suite.

What is the difference between JUnit and TestNG?

  • TestNG supports parallel testing, while JUnit does not have such a feature.
  • The process of parameterized test configuration in TestNG is easier than in JUnit (it requires more time and effort).
  • JUnit does not support group test, while in TestNG, the specialists are able to administrate certain tests to a large group of people at the same time.
  • TestNG supports the dependency tests with the help of such attributes – dependsOnMethods or dependsOnGroup. JUnit does not support this function.
  • JUnit is not able to support special annotations that TestNG can. They are @AfterGroups, @AfterSuite, @AfterTest, @BeforeTest, @BeforeSuite, @BeforeGroups.

TestNG possesses not only the majority of JUnit features but also a lot of functions in terms of Selenium WebDriver testing framework.

Related Posts:

About Article Author

view more articles
Nataliia Vasylyna
Nataliia Vasylyna

View More Articles

0 Comments

write a comment

No Comments Yet!

You can be the one to start a conversation.

Add a Comment

Your data will be safe! Your e-mail address will not be published. Also other data will not be shared with third person.
All fields are required.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.