JUNIT 5 vs TESTNG

Adil Abdullah
2 min readFeb 6, 2023

Features Comparison :

Azure Devops:

ADO do accept junit test reports.

To publish the the TESTNG test results, since Azure DevOps does not support TESTNG test results format, but TESTNG also produces JUnit test results in a separate junitreports folder. So, we can publish TESTNG test results in JUnit format instead.

Conclusion:

TestNG objective is beyond unit test so it covers wider testing needs like Scenario Tests, Integration Test, Dependency Test, Ordering, Parallel Execution etc, but these feature are not supported in JUnit 5.

The JUnit 5 team have these above items in their road map, but they are extending a unit testing framework to support wider range of testing needs. Lets see how the new subsequent release of Junit 5 is able to address the wider testing need in comparison with TestNG

For Spring based application Junit fits best for doing the Unit and Integration Testing as it the default testing framework and Spring Provides lots of Test API with Mockito.

For general testing and Web Automation (Selenium) — TestNG is the de facto.

--

--

Adil Abdullah

Currently working as Full stack Java developer at Contour Software at their Easit AB division part of Jonas group. Working on Java and IBM stack.