A couple of days ago, I wrote about unit testing with GraphUnit. GraphUnit tested the state of an embedded Neo4j database. What if you run Neo4j in standalone server mode? Fortunately, you can still test it and match subgraphs using the GraphAware Neo4j RestTest library.
Grab the GraphAware Neo4j Framework and GraphAware Neo4j RestTest jars from the Downloads page. Drop them into the plugins directory of your Neo4j installation and restart the server to be able to use the API’s.
All you have to do is POST your cypher to
http://your-server-address:7474/graphaware/resttest/assertSubgraph to verify the state of your graph.
Emptying the database before the next test is achieved via POSTing to
BaseTest uses the RestTest endpoints to
The unit test itself remains mostly unchanged.
Conveniently exposed as REST endpoints, RestTest lends itself nicely to testing against your Neo4j server in any language that can make an HTTP request.
Read more at https://github.com/graphaware/neo4j-resttest