In JUnit, which annotation is used to execute a method before each test method in the test class?

  • @BeforeClass
  • @BeforeEach
  • @BeforeMethod
  • @BeforeTest
In JUnit, the @BeforeEach annotation is used to execute a method before each test method in the test class. This is often used for setup operations required before each test case.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *