There are differences in the way that JUnit and
Java Explorer run tests. In JUnit TestSuites, values and global variables that need to be initialized in the
init() test case cannot be passed from one test case to the next.
Example
The execution sequence of the following
Java Explorer project, that contains an
init() test case, an
end() test case, and two test cases, is:
- InitTestCase
- TestCase1
- TestCase2
- EndTestCase
In JUnit, the execution sequence of the same project is:
- InitTestCase (setUp)
- TestCase1 (testMethod1)
- EndTestCase (tearDown)
- InitTestCase (setUp)
- TestCase2 (testMethod2)
- EndTestCase (tearDown)