Learn Java Unit Testing with JUnit 5 in 20 Steps

Video description

JUnit tutorial for beginners with examples

About This Video

  • Create a new project for JUnit tests
  • Create and run JUnit tests
  • Write good unit tests
  • Use assert methods
  • Use basic JUnit annotations
  • @Test, @BeforeEach, @AfterEach, @AfterAll, @BeforeAll
  • Test performance and exceptions in unit tests
  • Write parameterized tests- adhere to JUnit best practices
  • Use Eclipse to write and run JUnit tests

In Detail

JUnit is a unit testing framework for the Java programming language. JUnit has been important in the development of test-driven development and is one of a family of unit testing frameworks which is collectively known as xUnit frameworks. In this beginners tutorial on JUnit, you will learn how to

Audience

Students new to unit testing and who want to understand unit testing. Students who want to understand the JUnit framework. Students with basic Java knowledge.

Publisher resources

Download Example Code

Table of contents

  1. Chapter 1 : JUnit 5
    1. Introduction
    2. Course Overview
    3. Step 01 - Introduction to Unit Testing - Test Pyramid
    4. Step 02 - First Junit Test - Red bar
    5. Step 03 - Absence of failure is success
    6. Step 04 - First Unit Test with JUnit - String length() method
    7. Step 05 - Writing JUnit Assertions - assertNull and assertTrue
    8. Step 06 - Writing Assertions for Arrays - assertArrayEquals
    9. Step 07 - Setting up data for every test - @BeforeEach, @AfterEach
    10. Step 08 - Setting up database connections - @BeforeAll, @AfterAll
    11. Step 09 - Tip - Testing Exceptions with Junit
    12. Step 10 - Tip - @DisplayName and test methods need not be public
    13. Step 11 - Basics of Parameterized tests
    14. Step 12 - Advanced Paramaterized Tests with Csv Source
    15. Step 13 - Tip - Giving a name to a Parameterized Test
    16. Step 14 - Tip - Repeat same test multiple times
    17. Step 15 - Tip - Unit Testing for Performance
    18. Step 16 - Tip - Disable Unit Tests
    19. Step 17 - Tip - Grouping Tests with @Nested
    20. Step 18 - Tip - JUnit 5 = Platform + Jupiter + Vintage
    21. Step 19 - Tip - JUnit 4 vs JUnit 5
    22. Step 20 - Tip - JUnit Best Practices
    23. Step 21 - Tip - JUnit Patterns - xunitpatterns
  2. Chapter 2 : JUnit 4
    1. Step 99 - JUnit 4 Section - First Version of the course
    2. Getting Ready for Hello World
    3. Your First JUnit Success - Green Bar
    4. Refactoring: Improving the Junit
    5. assertTrue and assertFalse
    6. @Before and @After
    7. @BeforeClass and @AfterClass
    8. Comparing Arrays - assertArrayEquals
    9. Unit Testing Exceptions
    10. Unit Testing for Performance
    11. Parameterized JUnit Tests
    12. Organizing Unit Tests into Suites
    13. How do you write good Unit Tests?
    14. Conclusion

Product information

  • Title: Learn Java Unit Testing with JUnit 5 in 20 Steps
  • Author(s): In28Minutes Official
  • Release date: May 2018
  • Publisher(s): Packt Publishing
  • ISBN: 9781789340648