Reputation: 1095
I want to do unit testing for my application in neo4j with java code .We are writing junit test cases for it. But we want when we run the junit test cases it should not communicate it to the main database rather then some other mockup data.
We are using neo4j server and no embedded database is used.
How could this be achieved?
How can we create mockup data for testing neo4j related code?
How to create a mocked database for unit testing so that main database not be touched.
Is there any tool to mock the main database or we have to do it manually through the code?
Upvotes: 1
Views: 2361
Reputation: 3024
An option is Neo4j for Test Containers.
If you use Maven (or a compatible tool), another option is this Maven plug-in, which I'm still maintaining.
Test containers are maybe simpler and with a community of users, the plug-in way allows for a self-contained build: once you have Java and Maven, nothing else is needed, while Test containers require the Docker Daemon.
Upvotes: 0
Reputation: 30417
We've got a great article on testing your Neo4j-based Java application that should give you a few options for testing.
Upvotes: 2