Possible Duplicate:
Choose order to execute JUnit tests
I am writing a JUnit test. My classes cannot be tested independently, one test depends on another one sequentially.
May I ask: If I have setUp() in the suite class, can I run test cases sequentially and let them share the same context?
Thank you and have a great day. 🙂
Have a look at answers in similar posts specifying-order-of-execution-in-junit-test-case and choose-order-to-execute-junit-tests.
I think instead of relying on the sequential execution, it is better to have
SetUp(method annotated with@Before) andTearDown(method annotated with@After) methods.