Monitor Unit Tests With TestWatcher

1. Overview In this tutorial, we'll investigate how we can monitor unit tests using JUnit test rules. JUnit provides the TestWatcher class as a tem...

Continue Reading

Conditional Ignore JUnit Test Rule

1. Overview In this tutorial, we'll examine how we can create a custom JUnit test rule to introduce new behavior to our tests. In the end, we'll ha...

Continue Reading

Verify Exceptions with JUnit

1. Overview In this tutorial, we'll look at different ways to verify exceptions in a JUnit test. 2. Verifying Exceptions using @Test Annotation Fir...

Continue Reading

Built-in JUnit Test Rules

1. Overview In this tutorial, we'll look at the built-in JUnit test rules. In the end, we'll have the knowledge to use them at appropriate places. ...

Continue Reading

Set Timeout for Tests with JUnit

1. Overview In this tutorial, we'll look at how we can set timeouts for unit tests using JUnit. 2. Set Timeout for a Single Test Firstly, let's see...

Continue Reading

Structure of JUnit Test Rule

1. Overview In this tutorial, we'll look at the basic structure of a JUnit test rule. 2. TestRule Interface The TestRule interface is the main inte...

Continue Reading