简体   繁体   English

如何使用Scala对Neo4j进行单元测试?

[英]How to unit test Neo4j with Scala?

I need to test some Neo4J queries in my unit/integration tests with Scala. 我需要在Scala的单元/集成测试中测试一些Neo4J查询。

Is there any way to do it? 有什么办法吗? the only solution is Neo4j embbeded? 唯一的解决方案是嵌入Neo4j?

I do not recommend to test against embedded or use the embedded option. 我不建议针对嵌入式测试或使用嵌入式选项。 If you have the chance to try the latest Neo4J, version +3.0, you will be able to get a performance improvement as version +3.0 introduced the Bolt protocol . 如果您有机会尝试使用最新的Neo4J版本+3.0,则由于版本+3.0引入了Bolt协议 ,您将可以提高性能。

Prior to 3.0 you had to either use the REST endpoints, that you can easily test using scalatest,etc..., or go with the embedded option, which is explicitly discouraged as stated in the documentation. 在3.0之前,您必须使用REST端点(可以使用scalatest等轻松地进行测试),或者使用嵌入式选项,该选项在文档中已明确禁止使用。 Other libraries are available, such as Anormcypher, to access Neo4j prior to 3.0v. 在3.0v之前,还可以使用其他库(例如Anormcypher)来访问Neo4j。

If you are able to use +3.0 you can use the Java API https://github.com/neo4j/neo4j-java-driver 如果您能够使用+3.0,则可以使用Java API https://github.com/neo4j/neo4j-java-driver

There is a similar question available at SO: Neo4j - Unit testing REST Api calls SO上存在类似的问题: Neo4j-REST api调用的单元测试

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM