首页 > 解决方案 > 如何使用 JUnit 5(在 Kotlin 中)设置 Spring Data Neo4j 集成测试?

问题描述

Web 上使用 Neo4j 进行 Spring 集成测试的大多数示例仍然在 JUnit 4 上,并使用 Neo4jRule。

我们如何为 Neo4j + Spring + JUnit 5 创建设置?

标签: springneo4jspring-data-neo4jspring-testjunit5

解决方案


如果您在嵌入式上进行测试,请使用带有简单 Spring 配置的测试工具。

这里有些例子:

https://medium.com/neo4j/testing-your-neo4j-based-java-application-34bef487cc3c

https://github.com/michael-simons/neo4j-sdn-ogm-tips/tree/master/examples/using-the-test-harness https://github.com/michael-simons/neo4j-sdn-ogm -tips/tree/master/examples/using-testcontainers

https://github.com/neo4j/neo4j-java-driver-spring-boot-starter/tree/master/examples/testing-with-neo4j-harness

我会关注上面的 ^^ 这和测试容器将是我们前进的方向。

注意:@Neo4jExtension 主要由核心团队内部使用,不推荐用于一般用途。


推荐阅读