Hi Christian, I find tests with mocked persistence layer really good, but for me they are fast Unit tests. We need additionally (independent from Unit) integration/systests. For integration tests I see two possibilities to make them successfully running more than once: A) Generate unique ID for DB keys; B) Clean up after each test.
Every approach has pros and cons, personally I would accept both. Sure, we should be able to run also integration tests more than once without restart and reinitialize DB. Cheers, Andrei. > -----Original Message----- > From: Christian Schneider [mailto:[email protected]] On Behalf Of > Christian Schneider > Sent: Montag, 10. Dezember 2012 13:26 > To: [email protected] > Subject: Rerunning tests and additional rest tests with mocked persistence? > > Hi all, > > while testing how adding the CXF libs influences the syncope tests I found a > problem with the current rest tests. > > The problem is that at least some of the tests can not simply be rerun. > For example org.apache.syncope.core.rest.RoleTestITCase.create() only > seems to succeed once. > When I start the server and rerun the test from eclipse it fails as the role > is > already there. > > So one way to solve this would be to make each test method clean up after > itself. So at least after a successful test the db should be ready for another > run. > > One other way would be to create some additional tests that work with a > mocked persistence layer. These tests would then always be able to rerun as > they do not need or change the db. > > I think it makes sense to follow both of these approaches. So what do you > think? > > Christian
