0

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. :)

Community
  • 1
  • 1
lucky_start_izumi
  • 2,511
  • 13
  • 41
  • 61

1 Answers1

3

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) and TearDown(method annotated with @After) methods.

Community
  • 1
  • 1
Kuldeep Jain
  • 8,409
  • 8
  • 48
  • 73