I am currently using GraphUnit, Spock, and an in process Neo4j server to do integration testing on my Spring Data Neo4j 4.0 backed application.
It has been a very nifty tool in doing assertions on the state of the graph database after my test operations but I have noticed that in order for GraphUnit's assertGraph
and printGraph
to show me what I expect, my Neo4j transactions must be committed first. Logically this makes sense to me but it also means that I cannot mark my integration tests @Transactional
and that any data changes made to the in process database in one test will bleed into subsequent tests.
I am handling this by clearing the database after every test method in a Spock fixture method and this works fine but I would very much like to be able to:
- Set up a test Neo4j data set ONCE
- Have test method changes roll back after each test
- Still somehow be able to use GraphUnit's assertion and print utilities
My question is - is there a way to accomplish all three? Is it an underlying requirement / assumption that transactions commit if I want to use GraphUnit?