Mention what is the difference between JUnit and TestNG?

devquora
devquora

Posted On: Feb 22, 2018

 

JUnitTestNG
In JUnit the naming convention for annotation is a bit complicated for, e.g., “Before”, “After” and “Expected”.In TestNG it is easier to understand annotations like “BeforMethod”, “AfterMethod” and “ExpectedException”.
In JUnit, for a method declaration you have to follow a specific style like using “@BeforeClass” and “@AfterClass”.In TestNG, there is no restriction like you have to declare methods in a specific format.
In JUnit method name constraint is present.In TestNG method name constraint is not present, and you can determine any test method names.
JUnit framework does not have “Parameterized Test” or “Dependency Test” features.TestNG use “dependOnMethods” to implement the dependency testing.
In JUnit grouping of test cases are not available.In TestNG, grouping of test cases is available.
JUnit does not support parallel execution on Selenium test cases.In TestNG Parallel execution of Selenium test cases are possible.
It cannot re-run the failed cases.It can rerun the failed tests.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    JUnit Interview Questions

    Explain what is JUnit?

    JUnit is a testing framework for unit testing.  It uses Java as a programming platform, and it is an Open Source Softw..

    JUnit Interview Questions

    Mention different methods of exception handling in JUnit?

    Exceptional or analogous conditions during program execution require special processing methods and this exception hand..

    JUnit Interview Questions

    Explain who should use JUnit – a developer or tester? Why you use JUnit to test your code?

    JUnit is more often used by developers to implement unit tests in JAVA.  It is designed for unit testing that is more ..