EDUCBA Logo

EDUCBA

MENUMENU
  • Explore
    • EDUCBA Pro
    • PRO Bundles
    • All Courses
    • All Specializations
  • Blog
  • Enterprise
  • Free Courses
  • All Courses
  • All Specializations
  • Log in
  • Sign Up
Home Software Development Software Development Tutorials JUnit Tutorial JUnit version
 

JUnit version

Updated April 18, 2023

JUnit version

 

 

Introduction to JUnit Version

JUnit is an open-source framework that is used for unit testing for the Java programming language. It is quite a useful framework for the Java developers for the TDD (Test Driven Development) for writing and the execution of repeatable test cases. It is an important part/ instance of xUnit architecture which is important for unit testing. The org.junit package of JUnit contains various classes and interfaces required for the running of test cases. Various versions of JUnit have been released till now introducing new features every day to make it easier and simpler for the developer to code and run the test cases on it.

Watch our Demo Courses and Videos

Valuation, Hadoop, Excel, Mobile Apps, Web Development & many more.

Versions of JUnit

Let us understand the broad categorization of the various JUnit versions in detail:

1. JUnit 5

JUnit 5 is the latest generation of JUnit. It includes focussing on Java 8 and above with the facility of allowing various types of testing for developers on JVM. The latest release of the JUnit 5 generation is 5.7.1 which was released in February 2021. JUnit is composed of 3 different modules, i.e.

  • JUnit Platform: It basically serves as a foundation for launching the testing frameworks. It also defines the API for TestEngine for developing that testing framework that will run on that platform.
  • JUnit Jupiter: It is basically a combination of extension model and programming model for extensions and writing of test cases in JUnit 5. It provides the TestEngine to run the Jupiter-based test cases on the platform.
  • JUnit Vintage: It basically provides the TestEngine to run the JUnit 3 and JUnit 4 test cases on the platform.

2. JUnit 5.7.1

The major bug fixes and the new features that were introduced in JUnit 5.7.1 are given below:

  • Nested Tests are explained in detail in the user guide.
  • New JUnit method, i.e. ‘ TestInstancePreDestroyCallback’ helps ensure to the developer that all the test cases are processed when used in conjunction with @Nested tests.
  • Function ‘ExtensionContext.Store.getOrComputeIfAbsent()’ will be called only once even if on throwing the exception.
  • Legacy reports in XML will include all the container-level failures.
  • ‘ClassPathScanner’ method name ‘scanForClassesInPackage(String)’ will return the valid list of class names when the package name is equal to the module name.

3. JUnit 5.7.0

This version of JUnit was released in September 2020. Major bug fixes and the new features introduced in JUnit 5.7.0 are given below:

  • Global resource lock is now supported by HierarchicalTestEngine.
  • The annotation ‘@testable’ can now target any element like package, class, method, modules, etc.
  • In ‘FileSelector’ and ‘ClasspathResourceSelector’, ‘FilePosition’ is now supported.
  • Many changes were introduced in EngineTestKits.
  • All the methods declared in EngineExecutionListener will have the empty default implementation.
  • Some of the APIs like @Timeout, @TestMethodOrder, TestInstanceFactory, @DisplayNameGneration, etc were promoted from experimental to stable.
  • In order to enable and sizable a test on the basis of some condition methods, new @EnabledIf and @DisabledIf annotations were introduced.

4. JUnit 5.6.2

This version of JUnit was introduced in April 2020. Some of the major changes and the new features introduced in the JUnit 5.6.2 are given below:

  • JUnit 4 ‘Descriptions’ is now changed to ‘getDisplayName’ in order to generate display names if the ‘getMethodName’ displays the blank string instead of exception.
  • For the classes that do not match with the supplied ‘Predicate’, inner class cycles will no longer get detected by ‘ReflectionSupport.findNestedClasses’.
  • If the inner class is not annotated with ‘@Nested’, test discoveries will no longer get halts for inner class hierarchies which form a cycle.

5. JUnit 5.6.1

This version of Junit was released in March 2020.Some of the changes and the new features that were introduced in JUnit 5.6.1 are given below:

  • An important change that was introduced in this release is that URLs are no longer catched when loading junit- platform.properties files in order to avoid file locking issues in Microsoft Windows.
  • Only a warning will be given to the user if the multiple files with the different classpaths were present in junit-platform.properties.
  • No JUnit Vintage changes were introduced in this release.
  • Bug Fix related to TestInstancePreDestroyCallback was introduced in this release.

6. JUnit 5.6.0

This version of JUnit was released in January 2020. Some of the bug fixes and the major features that were introduced in this release are given below:

  • New execution conditions were introduced for @EnabledForJreRange and @DisabledForJreRange.
  • Annotation @Order now allows the developer to specify the relative order.
  • Error reports discovered during the failures in test execution were improved in this release.
  • Usage of any() and none() is supported in tag expressions.
  • Improvements in @CsvSource and @CsvFileSource were made.
  • For the Vintage Engine various bug fixes and the performance improvement changes were made.

7. JUnit 4

There were various versions released for JUnit 4. The last version of the JUnit 4 that was released was JUnit 4.13.2. Various new features and bugs were fixed in this overall release. Some of them are given below:

  • The unit testing framework for Java was completely redesigned in this release.
  • This release requires the use of Java 5 and above.
  • It was basically based on annotations rather than on the naming conventions.
  • Feature of timeout and an exception test was introduced.
  • Annotations like @Before, @BeforeClass, @After, @AfterClass, etc were introduced in this release.
  • Command-line –filter param was supported in this release.
  • Custom test runners are allowed to create their own TestClasses.
  • AnnotationValidator framework and validation checks for @Category were added.
  • AssertionError handling was fixed in this release.
  • New Constructors and factories for Timeout were introduced in this release.

8. JUnit 3

Some of the features that were introduced in JUnit 3 version of JUnit are given below:

  • Test method must start with the prefix ‘test’.
  • All the test fixtures need to be inherited from junit.framework.TestCase.
  • Asserts are reported as failures in the test reports in this release.
  • It is perfectly ok to use multiple asserts in a single method.
  • Some programmatic preparations need to be made before the running of test cases which is often matched by some cleanups afterward.

Conclusion

The above description clearly explains the various versions of JUnit and the major features that were introduced in each version. For a programmer, it is very important to understand the major changes and the new features introduced in the new releases and keep updated with them.

Recommended Articles

This is a guide to JUnit version. Here we discuss the broad categorization of various versions of JUnit along with the major features. You may also have a look at the following articles to learn more –

  1. Junit Interview Questions
  2. JUnit Maven Dependency
  3. Java Repository
  4. JavaFX Animation
Primary Sidebar
Footer
Follow us!
  • EDUCBA FacebookEDUCBA TwitterEDUCBA LinkedINEDUCBA Instagram
  • EDUCBA YoutubeEDUCBA CourseraEDUCBA Udemy
APPS
EDUCBA Android AppEDUCBA iOS App
Blog
  • Blog
  • Free Tutorials
  • About us
  • Contact us
  • Log in
Courses
  • Enterprise Solutions
  • Free Courses
  • Explore Programs
  • All Courses
  • All in One Bundles
  • Sign up
Email
  • [email protected]

ISO 10004:2018 & ISO 9001:2015 Certified

© 2025 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

EDUCBA
Free Software Development Course

Web development, programming languages, Software testing & others

By continuing above step, you agree to our Terms of Use and Privacy Policy.
*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA Login

Forgot Password?

🚀 Limited Time Offer! - 🎁 ENROLL NOW