O'Reilly logo

Mastering Software Testing with JUnit 5 by Boni García

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Test lifecycle

There are a set of extension points aimed at controlling the life cycle of tests. First of all, the TestInstancePostProcessor can be used to execute some logic after the test instantiation. After that, there are different extensions which control the pre-test stage:

  • The BeforeAllCallback defines the logic executed before all tests.
  • The BeforeEachCallback defines the logic executed before a test method.
  • The BeforeTestExecutionCallback defines the logic executed immediately before a test method.

Similarly, there are extensions to control the post-test phases:

  • The AfterAllCallback defines the logic executed after all tests.
  • The AfterEachCallback defines the logic executed after a test method.
  • The AfterTestExecutionCallback ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required