As you know, JUnit and TestNG are very popular unit testing frameworks for java software developers and we can use them in our webdriver test execution for any software web application. Till now, I have described all WEBDRIVER TUTORIALS with junit framework. Many peoples are asking me to describe the similarities and difference between JUnit and TestNG Framework. First of all let me give you few similarities of JUnit and TestNG frameworks and then I will tell you difference between both of them.
(Note : Bellow given similarities and differences are based on JUnit 4 version.)
Similarities Between JUnit and TestNG
- We can create test suite in JUnit and TestNG both frameworks.
- Timeout Test Is possible very easily in both the frameworks.
- We can ignore specific test case execution of software web application from suite in both the frameworks.
- It is possible to create expected exception test for software web application in both the frameworks.
- Annotations - Few annotations are similar in both frameworks suite like @Test, @BeforeClass, @AfterClass. JUnit's Annotations @Before and @After are similar to TestNG's @BeforeMethod and @AfterMethod annotations.
Difference Between JUnit and TestNG
- In TestNG, Parameterized test configuration is very easy while It is very hard to configure Parameterized test in JUnit.
- TestNG support group test but it is not supported in JUnit.
- TestNG has a feature to configure dependency test. Dependency test configuration for software web application is not possible in JUnit.
- TestNG support @BeforeTest, @AfterTest, @BeforeSuite, @AfterSuite, @BeforeGroups, @AfterGroups which are not supported in JUnit.
- Test prioritization, Parallel testing is possible in TestNG. It is not supported by JUnit.
- View more features of TestNG @ THIS LINK .
If you knows more differences or features then you can post it by commenting bellow.
No comments:
Post a Comment