Java: Testing with JUnit
2h 20mIntermediate2021-09-23
Authors
Maaike van Putten
Trainer and Developer for Java, Python, Spring Boot, and More
Course details
Unit testing is of crucial importance in developing stable applications. Java developers need to write unit tests, and JUnit is the main unit testing framework for Java. In this course, trainer and developer Maaike van Putten helps you learn to test your Java code effectively. Maaike explains what unit testing is and the advantages that it offers. She covers JUnit and shows you how to set it up and run your first test. Maaike steps through the process of writing a basic test, including useful tools like JUnit Annotations, JUnit Write, JUnit DisplayName, and more. She goes over more advanced uses of JUnit, such as dependency injection, parameterized tests, and timeouts, to name a few. Maaike finishes up with a quick peek at next steps you can take, like how to make code ready for unit testing, best practices, and a brief overview of Mockito.
Skills covered
JUnitSoftware TestingJavaOracleProgramming LanguagesOpen SourceSoftware DevelopmentDeep Dive (X:Y)
Concepts
0. Introduction
- 01 - Create proper unit tests in Java
- 02 - What should you know
- 03 - Unit testing and other types of testing
- 04 - TDD - Test-driven development
- 05 - Advantages of unit testing
- 06 - What is JUnit
1. Getting Started with JUnit
- 07 - Quick example of a basic unit test
- 08 - Setting up JUnit for IntelliJ
- 09 - Setting up JUnit for VS Code
- 10 - Setting up JUnit for Eclipse
- 11 - Your first test - HelloJUnit
2. Writing Basic Tests with JUnit
- 12 - Annotations
- 13 - Write and run test classes and methods
- 14 - DisplayName
- 15 - Assertions
- 16 - Assumptions
- 17 - Test execution order
- 18 - Nested tests
3. More Advanced Usage of JUnit
- 19 - Dependency injection in your tests
- 20 - Repeated tests
- 21 - Parameterized tests
- 22 - Timeouts
- 23 - Parallel execution
- 24 - Lifecyle control - Before and after
- 25 - Custom messages and reports
- 26 - Conditional test execution
- 27 - Disabling unit tests
4. Quick Peek at Next Steps
- 28 - How to make code ready for unit testing
- 29 - Best practices
- 30 - Mockito
Conclusion
- 31 - Next steps with JUnit
Related courses
- Complete Guide To Java Testing with JUnit 5 & Mockito
- Advanced Selenium: Automation Frameworks
- Learning Selenium: Structure, Scale, Run, and Optimize Automated Tests
- Java: Practice Unit Testing
- Java: Automated API Testing with REST Assured
- Java for Data Scientists Essential Training
- Java: Automated API Testing with REST Assured (2021)
- Mobile Testing with Appium