So, as result there are a lot of an in-memory databases for unit testing, and there is prefect tool DBUnit for integration testing.
So, when you write integration test you can use DBUnit, which manipulates dataset. It works in the next way:
- before test method: set db content (set state)
- execute test method
- after test method compare result in db with expected one
What about NoSQL? For example, if you are using MongoDB or HBase, how is it possible to create unit tests without dependencies on standalone server? How is it possible to make integration test with minimum effort to keep data consistency?
I know the answer: NoSQLUnit - NoSQL Unit is a JUnit extension that helps you write NoSQL unit tests. Available on GitHub https://github.com/lordofthejars/nosql-unit
This perfect amazing breathtaking framework provides possibility to create elegant in-memory unit tests and powerful integration tests in DBUnit way! Moreover, it supports a lot of nosql databases:
- MongoDB (not only one instance, but also replica set and sharding!)
- Infispran engine (never heart about that before)
And what is the most important, documentation is perfect!
So, I want to say THANK YOU VERY MUCH, Alex Soto, you made amazing job!
Do you know any other tools for unit/integration testing for Nosql? Give me a link, please!