@BeforeAll and @AfterAll Annotation

This lesson demonstrates working of two more Lifecycle methods annotated with - @BeforeAll and @AfterAll Annotation.

We'll cover the following

@BeforeAll and @AfterAll

Methods annotated with @BeforeAll and @AfterAll are static methods because, as the name suggest they are called once before all and once after all @Test methods. So, if in a test class there are two @Test methods, the @BeforeAll method will be called once before all test methods and similarly, the @AfterAll method will be called once, just after all @Test method gets finished. Let’s look at demo taking previous lesson test class:-

Get hands-on with 1200+ tech skills courses.