Special offers now — see discounted courses.
day
:
hour
:
min
:
sec
See special offers
Complete Guide To Java Testing with JUnit 5 & Mockito

Complete Guide To Java Testing with JUnit 5 & Mockito

5h 9mAdvanced2024-10-29

Authors

Kathryn Hodge

Kathryn Hodge

Software Developer

Course details

In this comprehensive course, software developer Kathryn Hodge covers critical aspects of software testing in Java development. Learn about writing Java tests with JUnit 5, AssertJ, and Mockito frameworks. Find out how to write automated tests with assertions, explore the test lifecycle, use rich assertion sets with detailed failure messages, mock objects, stub methods, and verify interactions. Dive into testing Spring Boot applications, including repositories, services, controllers, integration testing, and mocking external dependencies. By the end of this course, you'll gain a solid understanding of testing methodologies and tools to ensure the quality and reliability of your Java applications.

Learning objectives
Master software testing techniques and methodologies to build high-quality, reliable Java applications.
Gain proficiency in using popular Java testing frameworks like JUnit 5, AssertJ, and Mockito for writing automated tests, assertions, mocking objects, and verifying interactions.
Develop skills to thoroughly test Spring Boot applications by learning to test repositories, services, controllers, handle integration testing, and mock external dependencies.

Skills covered

JUnitSpring BootSoftware TestingWeb Development ToolsAdvancedWeb DevelopmentOpen SourceSoftware Development

Concepts

0. Introduction

  • 01 - Why is testing important
  • 02 - What you should know
  • 03 - How to use Codespaces
  • 04 - Manage dependencies with Maven

1. Introduction to Software Testing

  • 05 - Key concepts in software testing
  • 06 - Using test cases to verify software
  • 07 - Types of software testing
  • 08 - Automated vs. manual testing
  • 09 - What is a testing framework
  • 10 - Java testing frameworks
  • 11 - Understand test-driven development (TDD)
  • 12 - Ensure quality with test coverage
  • 13 - Write effective tests with F.I.R.S.T. testing principles

2. Getting Started with JUnit 5

  • 14 - Set up JUnit 5 in your Java application
  • 15 - Write and run your first JUnit 5 test
  • 16 - Assertions in JUnit 5
  • 17 - JUnit 5 test lifecycle
  • 18 - JUnit 5 lifecycle hooks
  • 19 - Testing exceptions in JUnit 5
  • 20 - Debug tests in JUnit 5
  • 21 - Best practices for writing tests in JUnit 5
  • 22 - Challenge - Write a JUnit 5 test for a temperature converter
  • 23 - Solution - Write a JUnit 5 Test for a Temperature Converter

3. Build an Application Using Test Driven Development with JUnit 5 Tests

  • 24 - Task manager project prompt
  • 25 - Set up red phase for Add Task functionality in Test Class
  • 26 - Implement Get ID in Task Class
  • 27 - Implement Add Task and enter green phase
  • 28 - Prevent tasks with duplicate IDs
  • 29 - Implement Remove Task with Test Driven Development
  • 30 - Implement task descriptions with Test Driven Development
  • 31 - Implement Update Description with Test Driven Development
  • 32 - Implement Retrieve Task with Test Driven Development
  • 33 - Refactor tests to ensure maintainability

4. Advanced Testing Techniques with JUnit 5

  • 34 - Introduction to parameterized tests in JUnit
  • 35 - Parameterized tests with EnumSource in JUnit 5
  • 36 - Parameterized tests with ValueSource in JUnit 5
  • 37 - Parameterized tests with CsvSource in JUnit 5
  • 38 - Conditional test execution based on Java version and OS
  • 39 - Conditional test execution based on environment variables
  • 40 - Conditional test execution based on custom conditions
  • 41 - Control test execution with @Order
  • 42 - Create test suites in JUnit 5
  • 43 - Create a test coverage report with JaCoCo
  • 44 - Ensure test coverage with JaCoCo
  • 45 - Execute parallel tests in JUnit 5
  • 46 - Custom extensions in JUnit 5
  • 47 - Challenge - Write a test class for a email validator
  • 48 - Solution - Write a test class for a email validator

5. More New Annotations with JUnit 5

  • 49 - Add a display name to your tests
  • 50 - Nested tests
  • 51 - Timeout
  • 52 - AssertTimeout
  • 53 - AssertAll
  • 54 - Message suppliers
  • 55 - Assumptions API
  • 56 - TempDir
  • 57 - Migrate from JUnit 4 to JUnit 5
  • 58 - Challenge - Sorting algorithm validation
  • 59 - Solution - Sorting algorithm validation

6. Getting Started with Mockito

  • 60 - Set up Mockito
  • 61 - Mocking basics
  • 62 - How to mock an object in Java
  • 63 - Stub a method with Mockito
  • 64 - Verify an interaction with Mockito
  • 65 - Verify arguments with argument matchers
  • 66 - Verify arguments with argument captors
  • 67 - Challenge - Test a library management system
  • 68 - Solution - Test a library management system

7. Advanced Mockito Techniques

  • 69 - Spy on real objects with Mockito
  • 70 - Test exception handling with Mockito
  • 71 - Test void methods with Mockito
  • 72 - Verify no (or a set number of) interactions
  • 73 - GetAllValues with ArgumentCaptor
  • 74 - Test asynchronous code with Mockito
  • 75 - Mock a static method with Mockito
  • 76 - Challenge - Test an ordering service
  • 77 - Solution - Test an ordering service

8. Testing Spring Applications with JUnit 5 and Mockito

  • 78 - Walk through a basic Spring Boot application
  • 79 - Write your first Spring Boot test
  • 80 - Test Spring data repositories
  • 81 - Test Spring services
  • 82 - Test Spring controllers
  • 83 - Integration testing with Spring Boot
  • 84 - Best practices and tips for testing Spring Applications
  • 85 - Challenge - Test a Spring weather application
  • 86 - Solution - Test a Spring weather application

Conclusion

  • 87 - Reflect on testing in Java - Key takeaways and insights

About us

LyndaKade is a leading learning platform that helps people learn business, software, technology, and creative skills to achieve personal and professional goals.

Phone numberAparat ChannelTelegram SupportTelegram ChannelInstagram Page

All rights to this site belong to LyndaKade.

Terms of Service|Privacy Policy

نماد الکترونیک enamad در صورت اتصال با آی‌پی داخل کشور، نمایش داده خواهد شد.
logo-samandehi - لوگو ساماندهی
Zarinpal
Zibal