1.

What are the differences between JUnit 4 and JUnit 5?

Answer»
CategoryJUNIT 4JUnit 5
Annotation for executing method before all test methods run in the current class@BeforeClass@BeforeAll
Annotation for executing method after all test methods run in the current class@AfterClass@AfterAll
Annotation for executing method before each test case@Before@BeforeEach
Annotation for executing method after each test method@After@AfterEach
ArchitectureIt has everything like PLATFORM, annotations etc bundled in a single jar file.JUnit 5 is composed of 3 sub-units - JUnit Platform, JUnit Jupiter and JUnit Vintage
Required JDK VersionThis needs Java 5 or higher versions.This needs Java 8 or above.
AssertionsAssert methods are present in org.junit.Assert package for validating expected and actual outputs.Assert methods are present in the org.junit.jupiter.Assertions package. The methods also have overloaded methods for SUPPORTING error messages in case TESTS FAIL.


Discussion

No Comment Found