Interview Questions

Can You Explain the Life Cycle of a JUnit 3.8 Test Case Class?

JUnit Questions and Answers


(Continued from previous question...)

Can You Explain the Life Cycle of a JUnit 3.8 Test Case Class?

A JUnit 3.8 test case class contains a setUp() method, a tearDown() method and multiple testXXX() methods. When calling a test runner to run this test class, the runner will execute those methods in a specific order giving the test case class an execution life cycle like this:

setUp()
testXXX1()
tearDown()

setUp()
testXXX2()
tearDown()

setUp()
testXXX3()
tearDown()

...

(Continued on next question...)

Other Interview Questions