Neo4j-REST api调用的单元测试 [英] Neo4j - Unit testing REST Api calls

查看:82
本文介绍了Neo4j-REST api调用的单元测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将要使用Neo4j Server(Rest Api).

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

我已经考虑过对Neo4j进行单元测试的方式.

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

我发现 NoSqlUnit 的作用与DbUnit相同,但专门用于Neo4j等NoSql数据库.

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

但是,对于使用嵌入式版本Neo4J(使用纯Java,Scala ..)的用户来说,很容易设置主要解决方案.

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

由于嵌入式数据库的替代,是否存在一种有效的方法来对Rest Api调用进行单元测试?

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

更新----------------------

对不起,我误读了NoSqlUnit文档. 似乎有效的方法是创建由服务器包装的嵌入式数据库.也就是说,Rest API调用将指向localhost.非常适合单元测试.

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.

推荐答案

您可以使用包含newInProcessBuilder()

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

第二个选择是使用TestGraphDatabaseFactory().newImpermanentDatabase()

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

最后但并非最不重要(也是最好的)是使用GraphUnit

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

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

这篇关于Neo4j-REST api调用的单元测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆