Junit 4 + 5, execution order of @before, @beforeClass, @after, @afterClass

These notes are written differently in junit4 and junit5 versions

junit4 junit5 Features
@BeforeClass @BeforeAll Executed before all test methods of the current class. The note is on the [static method].
@AfterClass @AfterAll Executed after all test methods in the current class. The note is on the [static method].
@Before @BeforeEach Execute before each test method. The note is on the [non-static method].
@After @AfterEach Execute after each test method. The note is on the [non-static method].
Published 258 original articles · praised 433 · 90,000 views

Guess you like

Origin blog.csdn.net/qq_33709508/article/details/105504157