JUnit / Junit Interview questions
Differentiate @After and @AfterClass.
@After public void runAfterEachTest()
This method gets executed after every test and it is used to clean up the test and temporary data that are used by test.
@AfterClass public static void runAfterAllTheTest()
This method gets executed at the end, when all the tests have completed execution and gets executed only once.
Usually used for closing the database connection.
Method should be declared static.
More Related questions...