How can I group a few tests that have a common dependency, so that setUp()
/tearDown()
is executed for the whole group? I want to test SQL queries execution times but not including the time to load the database at each test setUp()
! TestSuite
doesn't even have setUp()
method! I just want to load the database before the first test and then perform each query in a separate test and then close and delete it after all tests are done. Can I have a common context/scope shared between tests or test methods?
Asked
Active
Viewed 232 times
0

WindRider
- 11,958
- 6
- 50
- 57
1 Answers
0
I don't know if JUnit3 has this (I would assume so, it's kind of important!), but in JUnit 4 there is an @Before and @After tag used for con/de-struction. some before docs and some after docs

ahodder
- 11,353
- 14
- 71
- 114
-
I know but Android supports only JUnit3. And I don't want to use 3rd party solutions for JUnit4 support. – WindRider Sep 13 '13 at 14:50
-
I didn't know that. I did find something on SO that might help though. http://stackoverflow.com/a/11916340/480691 – ahodder Sep 13 '13 at 14:52
-
Seems the thing I'm trying to do is not just a test but more of a benchmark. As I see JUnit3 is designed so that all tests run as new instances, not sharing any state. Maybe I have to try a more complex testing solution. – WindRider Sep 13 '13 at 15:14