2

I know that variations of this question have been asked over and over but I can't seem to find a good answer.

I have some integration tests which require a live database that is running to perform the tests.

Since starting up and shutting down the database is costly, I don't want to do this for every single test method. Therefore, I want something that will run before all tests in a test suite, and after all tests in a test suite. It's also important that nested test suites don't run their own before and after methods if the root test suite has already defined these.

So to recap:

  1. I want to run a method before and after tests in a test suite are executed.
  2. I want to have nested test suites that can be run on their own, or as a larger set of tests and still have these methods called only once.

Does anyone have some good solution for this problem?

oberlies
  • 11,503
  • 4
  • 63
  • 110
Casey Jordan
  • 1,204
  • 1
  • 20
  • 39
  • 2
    Look in to this page: may be you could find answer for it http://stackoverflow.com/questions/6580670/testsuite-setup-in-junit-4 – Delli Kilari Nov 13 '13 at 19:11
  • Or here: http://stackoverflow.com/questions/3007425/how-to-load-dbunit-test-data-once-per-case-with-spring-test/9006655#9006655 – Kkkev Nov 15 '13 at 23:25
  • @Casey: It would help if you could provide details about what from the solutions to other related questions doesn't work for your specific problems. I.e. clarify why this question is not a duplicate of the others. – oberlies Jan 10 '14 at 10:21

0 Answers0