Check the get started guid https://junit.org/junit5/docs/current/user-guide/#overview-getting-help
package com.in28minutes; import org.junit.jupiter.api.*; import static org.junit.jupiter.api.Assertions.assertEquals; /** * Before All * Before * Test * After each * Before * Test * After each * After All * Process finished with exit code 0 * */ public class MyMathTest { @BeforeEach public void before( ){ System.out.println("Before"); } @BeforeAll public static void beforeAll( ){ System.out.println("Before All"); } @Test public void sum_with3numbers() { System.out.println("Test"); MyMath math = new MyMath(); assertEquals(6, math.sum(new int[] {1,2,3})); } @Test public void sum_with1numbers() { System.out.println("Test"); MyMath math = new MyMath(); assertEquals(3, math.sum(new int[] {3})); } @AfterEach public void after() { System.out.println("After each"); } @AfterAll public static void afterAll() { System.out.println("After All"); } }