InterviewSolution
Saved Bookmarks
| 1. |
What is the purpose of @Before and @After annotations in JUnit 4? |
|
Answer» These are the annotations PRESENT in JUNIT 4. Methods annotated with @Before will be called and RUN before the execution of each test case. Methods annotated with @After will be called and executed after the execution of each test case. If we have 5 test cases in a JUnit CLASS, then the methods annotated with these two would be run 5 times. In JUnit 5, the annotations @Before and @After are renamed to @BeforeEach and @AfterEach for making it more readable. |
|