Reputation: 11
The application I am working on is a Velocity/Spring MVC/Mongo on tomcat kind of webapp.
I am able to run my integration tests on Embedded Mongo, using EmbedMongo which takes longer to run all the tests, say around 1 minutes but on the test database on installed Mongo, it takes around 15 secs.
Is there really any benefit in using Embedded databases for integration tests when creating a new db, (in this case a test db within the same instance) is a negligible effort ? In fact, the tests can themselves create the DB and required Collection.
Other than using Embedded Mongo on a CI box where the regular installation is not required, I don't see any great benefit in it.
Can anyone share any ideas please.
Thanks Gaurav
Upvotes: 1
Views: 1986
Reputation: 92112
Look at that link: https://stackoverflow.com/a/9830861/82609
It seems nice but the MongoDB is started and shutdown between each test.
What you may want to do, to increase speed, is to startup and shut down once for the whole test suite. I mean: keep the MongoDB instance up between tests.
But you don't want your tests to be dependant of each others. So what you could do is to use a different database name (UUID) so that in the end you have one MongoDB instance running, with many distinct databases, one for each test.
Or you can clean your database between each test.
Upvotes: 1
Reputation: 964
With a separate installed instance you have the process setup and teardown costs involved which you would want to minimize for your test suite hence the benefit of using Embedded DB.
Upvotes: 0