Java Testing – JUnit 5 Crash Course

Wordpress sites

JUnit 5 is one of the most popular frameworks for testing Java applications. In this crash course, you will learn about Junit 5 and how to use it to write unit tests for your Java programs.

✏️ Course created by Programming Techie. Check out their channel:

💻 Source Code for Starter Project:
💻 Source Code for Completed Project:

🔗 Written Tutorial:
🔗 Maven Tutorial:

⭐️ Course Contents ⭐️
⌨️ (00:00) Introduction
⌨️ (00:28) What is JUnit?
⌨️ (01:09) JUnit Architecture
⌨️ (02:19) First JUnit Test
⌨️ (08:26) Testing Exceptions using assertThrows()
⌨️ (10:10) Understanding JUnit Test Lifecycle
⌨️ (13:42) Conditional Executions
⌨️ (15:11) Assumptions
⌨️ (16:58) Repeated Tests
⌨️ (18:48) Parameterized Tests
⌨️ (23:47) Nested Tests
⌨️ (25:22) Disabled Tests

Learn to code for free and get a developer job:

Read hundreds of articles on programming:

And subscribe for new videos on technology every day:

22 thoughts on “Java Testing – JUnit 5 Crash Course”

    1. Somaditya Basak

      Thank you, this really helped me understand how to write JUnit tests. Can you please tell me the name of the icon pack that you’re using?

  1. Spock(in groovy) is much better than JUnit. Data Tables are amazing feature and you will never go back to JUnit or Jest or any other language’s framework. Write your code in java, kotlin etc, but write tests in groovy(spock).

  2. More Java related content please! But anyways, filled with gratitude for all the tutorials you have.

  3. Brandon Swenson

    This is a very good video. And I am realizing that 99% of my methods return void

  4. In the nested test of parameterized test, how does the static function providing the list doesn’t throw an error?

  5. Alexey Glukharev

    Great video, but I have a question. Why don’t you validate the parameters in the setters and the constructor of Contact, but use separate validation methods for this purpose. Those methods may not be called at all, then the object will be in an incorrect state.

  6. Somaditya Basak

    @ProgrammingTechie Thank you, this really helped me understand how to write JUnit tests. Can you please tell me the name of the icon pack that you’re using?

  7. By default, the Lifecycle of a Test class is PER_METHOD, so, after each test method is executed, the constructor of the Test class is called. This can be changed by using the @TestInstance(TestInstance.Lifecycle.PER_CLASS). Mentioning as additional point Just in case.

Comments are closed.