my team and I are working on a project in python which uses py2neo to access our neo4j graph.
We are currently trying to find an answer to the question:
'What is the correct approach to test our code?'
What we have now:
We understood that there are 3 main guide lines of what we want to test:
- that the expected nodes and relationships were created and the labels and properties correctly set
- that no other nodes or relationships were created, and that no additional properties or labels were set
- that existing parts of the graph remained untouched
(taken from https://graphaware.com/neo4j/2014/05/29/graph-unit-neo4j-unit-testing.html)
We have implemented a function that returns the diff between the initial state of the graph (the state of the graph before we run our queries)
and the final state.
We then compare that diff to our 'expected diff' which is a list of nodes and relationships that we expect to be created.
We are not so happy with that solution because:
- We need to set the initial state of the database
- We need to declare the 'expected diff', and it can get pretty big
- We have implemented that solution without researching the web for solutions
What we want:
The project is written in python, we found test frameworks in Java but that does not help us.
We would like to know if:
- Is there a way to dynamically load a pre-made graph (neo4j graph dump) using python code?
- Are there any APOC functions that compare two neo4j graphs and indicate the difference between them,
to the level of values of properties?
- Any other way to test our python code?