5

I am actually working on how to manage the execution of many jUnit classes calling the same database, the tests interact using Web-services.

If it is possible, it would be a great help if you would show me the paths i need to explore (technical aspects) knowing that the reset of the database is not an option, neither is the creation of many user/database instances...

4
  • I cannot answer this question as you state its not possible to test in isolation, I do want to note this is a clear test anti pattern: sqa.stackexchange.com/a/8516/3201 I would ask the development team to help you make testing in isolation possible, because this sounds like a nightmare... goodluck :) Apr 8, 2015 at 9:34
  • Hi, thanks for answering. I'll explain better maybe.. They already have junit classes to test the production plateform, the thing is the tests take too long because they are excecuted one after another, and after each test class, we have a reset of the database before executing the next one I want (if it is possible) an idea about how to manage to execute classes on the same time, optimizing that to gain time (since they spend a lot of time reseting database) and it took 10 hours to make all the tests at night (when everything is working fine,..). I need to make the tests run simultaneously .
    – B Assia
    Apr 8, 2015 at 13:30
  • I've read the link in the comment, actually that's what the dev team is doing already. they have a copy of the production infrastructure, on which they run the tests. So it doesn't respond to my question still..
    – B Assia
    Apr 8, 2015 at 13:33
  • No I think they are not. Else you could parallel run your tests, now they are depended on a single database, thus they are not run in isolation. I would create a new unique database for each individual test. I have described a possible setup in this question: sqa.stackexchange.com/a/12225/3201 Apr 8, 2015 at 13:52

1 Answer 1

2

No magic bullet. If you have a "multi-tenant" schema -- a schema that represents multiple, independent sets of data -- you may be able to run each concurrent test in a different data set.

It is hard to be more specific about this without knowing more about your database, but here is an example. Consider an application as a service for managing employees. One instance of the service handles multiple companies, so the database has a company table, and all employee information is associated with a company. If you want to run concurrent tests, you might run each in a different company so that they do not interfere with each other.

If that isn't possible, you might consider altering your schema so that it is possible. Sometimes is makes sense to adjust your software so that it is easier to test. Think about how that might apply to your own application.

1
  • Thanks for your answer, it's actually what i've settled for.
    – B Assia
    Apr 17, 2015 at 15:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.