Mik378
Mik378

Reputation: 22171

Neo4j - Unit testing REST Api calls

I'm about to use Neo4j Server (Rest Api).

I've thought to the way of unit testing Neo4j.

I found NoSqlUnit that play the same role as DbUnit but dedicated to NoSql database like Neo4j.

However, main solutions are easy to set up for those who use the embbeded version of Neo4J (in plain Java, Scala ..).

Is there an effective way to unit test Rest Api calls thanks to an embedded database substitution?

UPDATE ----------------------

Sorry, I misread the NoSqlUnit documentation. It seems that an effective way would be to create an embedded database wrapped by a server. That is, Rest API calls will point on localhost. Pretty for unit testing.

Upvotes: 3

Views: 1134

Answers (1)

MicTech
MicTech

Reputation: 45003

You can use org.neo4j.harness which contains newInProcessBuilder()

http://neo4j.com/docs/stable/server-unmanaged-extensions-testing.html

Second options is to use TestGraphDatabaseFactory().newImpermanentDatabase()

http://neo4j.com/docs/stable/tutorials-java-unit-testing.html

last but not least (and the best one) is to use GraphUnit

https://github.com/graphaware/neo4j-framework/tree/master/tests#graphunit

Upvotes: 2

Related Questions