Selenium JUnit 5 Tutorial Home / Video /

How To Write Test Cases in JUnit | JUnit 5 Tutorial | Part-II

How To Write Test Cases in JUnit | JUnit 5 Tutorial | Part-II

About the Video

In Part 2 of the JUnit 5 Testing tutorial series, join 𝑹𝒆𝒙 𝑱𝒐𝒏𝒆𝒔 (@RexJonesII), a seasoned QA Engineer, Trainer, YouTuber, and Blogger. Dive into the differences between JUnit 4 and JUnit 5 annotations and master the art of writing and running JUnit 5 test scripts. Additionally, discover how to add reviews and smoothly transition your test scripts from JUnit 4 to JUnit 5.

By following this walkthrough, you'll understand how to convert your test scripts from JUnit 4 to JUnit 5, and you won't want to miss the chance to enhance your testing skills!

Video Chapters

00:00 Introduction

00:08 JUnit 4 & JUnit 5 Annotations

05:30 Write JUnit 5 Test Scripts

20:25 Review & Write Assertions

31:10 Convert Test Scripts From JUnit 4 To JUnit 5

42:01 Closing

Key Topics Covered

Comparison of JUnit 4 and JUnit 5 Annotations: The video starts by comparing the annotations between JUnit 4 and JUnit 5, highlighting the differences in annotations except for the @Test annotation, which remains the same in both versions. It explains the new annotations in JUnit 5 such as @BeforeEach, @AfterEach, @BeforeAll, and @AfterAll in place of JUnit 4's @Before, @After, @BeforeClass, and @AfterClass.

Adding JUnit 5 Dependency: It guides on adding the JUnit 5 dependency to the pom.xml file for Maven projects, showcasing two methods to accomplish this.

Writing Test Scripts Using JUnit 5: The video demonstrates how to write test scripts using JUnit 5, focusing on a case study involving radio button interaction within a web application.

Assertions in JUnit 5: A significant portion is dedicated to discussing assertions in JUnit 5, explaining how they can be used to verify if a test passes or fails. It introduces various assertions like assertTrue, assertFalse, assertEquals, etc., and provides examples of their usage.

Converting JUnit 4 Test Scripts to JUnit 5: The presenter demonstrates the process of converting a test script from JUnit 4 to JUnit 5, first manually by updating annotations and assertions, and then using IntelliJ IDEA's automated tools to facilitate the conversion.

Related Blogs & Hubs

How To Run JUnit Tests In Jupiter? [JUnit Jupiter Tutorial]

How to execute JUnit 4 tests with JUnit 5 [Tutorial]

A Comprehensive Guide On JUnit 5 Extensions

Complete JUnit 5 Mockito Tutorial For Unit Testing

Rex Jones II

Rex Jones II

Rex is an Experienced Quality Assurance (QA) Engineer with a history of working in the IT and Services industry. Certified as a Certified Software Test Engineer (CSTE) and Test Management Approach (TMap). Also skilled in Automation, Agile Methodologies, Test Strategies, and Software Development Life Cycle (SDLC) with a passion for testing software manually or automation such as Selenium.

More Videos from Selenium JUnit 5 Tutorial