GraphAware Blog - GraphUnit

Find out what's new in the Neo4j world

Integration Testing Against Remote Neo4j

20 Aug 2015 by Adam George Neo4j Advanced GraphUnit Testing

Writing integration tests for your code that runs against Neo4j is simple enough when using the native API, but there’snot a great deal of help out there if you’re working in client-server mode. Making assertions about the shape of thegraph can also be difficult, particularly if use cases involve more than a few nodes and relationships.In all but the most simple of scenarios, it can be hard to see why the graph in the test database isn’t as expected,as the feedback is often as black-and-white as pass/fail so you can be looking for a proverbial needle in a haystackwhen trying...

Neo4j Server Unit Testing with RestTest

19 Jun 2014 by Luanne Misquitta Neo4j GraphAware Intermediate GraphUnit Testing

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.SetupGrab 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.How to use itAll you have to do is POST your cypher to http://your-server-address:7474/graphaware/resttest/assertSameGraph orhttp://your-server-address:7474/graphaware/resttest/assertSubgraph to verify the state of your graph.Emptying the database...

Neo4j Unit Testing with GraphUnit

16 Jun 2014 by Luanne Misquitta Neo4j GraphAware Intermediate GraphUnit Testing

Testing the state of an Embedded Neo4j database is now much easier if you use GraphUnit, a component of the GraphAware Neo4j Framework.I tried replacing an existing Flavorwocky unit test with GraphUnit to check out the benefits.Let’s walk through a before-after case study.The testThe unit test in question is the one to test that a Pairing is saved correctly. A pairing must have exactly two ingredients. Each Ingredient node has a name; a Pairing has an affinity and an array of allAffinities (all affinities ever assigned to the pairing).BeforePseudocode to test that my code saved a pairing correctly in Neo4j:...

GraphUnit: Testing Neo4j Code

29 May 2014 by Michal Bachman Neo4j GraphAware Intermediate GraphUnit Testing

Recently, we announced the GraphAware Framework. Today, I would like to introduce its first feature called GraphUnit. GraphUnit is a component that helps Java developers unit test their code that talks to Neo4j and mutates data.Unit Testing Neo4j CodeWhen writing Java code that modifies data stored in Neo4j, developers can use the ImpermanentGraphDatabase in conjunction with any of APIs provided by Neo4jto test that code. This includes the native Java API, the traversal framework, and Cypher.(I’ve excluded the REST API because using that to unit test Java code wouldn’t make much sense.)Let’s say we’re testing code that creates two nodes...