
Explore basic software testing by creating a Java Maven project, configuring JUnit 4, Hamcrest, and writing your first unit tests with assertions to verify expected results.
Explore test-driven development (TDD) by writing a failing unit test for a calculator's add and average methods, then implement production code and refactor to pass tests.
Master JUnit4 assertions by building a Maven-based testing module and using assertEquals, assertNotEquals, assertTrue, assertFalse, assertNull, assertNotNull, and assertThrows across arrays and primitive types.
Create a new java module with maven, add junit 5 dependencies, and learn core junit 5 assertions such as assertEquals, assertTrue, assertFalse, assertThrows, and assertArrayEquals through hands-on examples.
Learn how to configure repeated tests in JUnit 5 with @RepeatedTest, specify repetitions, and control execution order using @TestMethodOrder and @Order to produce deterministic test runs.
Introduces junit 5 parameterized tests, guiding dependency setup, parameter passing, and value sources such as value source, method source, and csv file source.
Learn how to use JUnit 5 TestInfo to access test class and method details, display names, and tags, and print this information to aid debugging and reporting.
set up a Java module with JUnit 5 and hamcrest, add the core API dependency, and write assertions using hamcrest matchers to compare actual and expected values.
Explore Hamcrest matchers through practical assertions, including is, equal, same instance, array and list checks, map keys and entries, hasProperty, and the anything matcher for flexible testing.
Create a Hamcrest custom matcher by extending a type-safe matcher to check if a string's length exceeds ten, and verify its behavior with a test class.
Learn to create a unit testing module and use Mockito to mock classes and verify interactions. Set expected returns for methods like hello and calculate, with assertions and exception handling.
Use Mockito argument matchers to stub methods and verify interactions with mocks, employing any string, any int, and custom matchers such as starts with, to handle flexible inputs.
Learn how to use Mockito thenAnswer to implement an answer callback, inspect invocations, access the method name and arguments, and return a value for a mocked say hello test.
As everyone knows, testing is very important for software development. Writing good test code can improve the quality of the software application and make code changes much easier.
- Software testing can also provide an objective, independent view of the software to allow the business to appreciate and understand the risks of software implementation.
- Software testing can provide objective, independent information about the quality of software and risk of its failure to users
This course covers some common software testing techniques and will teach you with code examples. Not only TDD, JUnit, but also Hamcrest Testing, Mockito Testing. I will show you step by step how to write a unit test method and explain the raisons behind.
Keep coding following each section, I believe you will be able to write good testing code throughout your development phase.
Software Testing Basics
- First Unit testing
- Debug Test
- Test coverage
- Test Principles & Good Unit Testing
- Test Driven Development
JUnit4 Testing
- JUnit4 Assertions
- JUnit4 Lifecycles
- JUnit4 Parameterized Test
- JUnit4 Test Rules
JUnit5 Testing
- JUnit5 Assertions
- JUnit5 Lifecycles
- RepeatedTest & Order of Test
- JUnit5 Parameterized Test
- JUnit5 TestInfo
Hamcrest Testing
- Hamcrest Basic
- Hamcrest Matcher Assertions
- Hamcrest Custom Matcher
Mock Testing
- Mockito Mock Class
- Mockito Mock Interface
- Mockito Argument Matchers
- Mockito thenAnswer
If you are interested, join this course and enjoy ~
Finally, you can download the project source code from attachment in the last section.