Java Intellij:'docker compose up'在单独的测试运行中?
我不能使用play按钮在Intellij1中运行单个测试,因为我们的集成测试需要运行mongo,但我可以使用Java Intellij:'docker compose up'在单独的测试运行中?,java,mongodb,intellij-idea,docker-compose,spock,Java,Mongodb,Intellij Idea,Docker Compose,Spock,我不能使用play按钮在Intellij1中运行单个测试,因为我们的集成测试需要运行mongo,但我可以使用Gradle选项卡运行所有集成测试,因为我们的build.Gradle中有以下内容: task integrationTest(type: Test) { testClassesDir = sourceSets.integrationTest.output.classesDir classpath = sourceSets.integrationTest.runtimeCl
Gradle
选项卡运行所有集成测试,因为我们的build.Gradle
中有以下内容:
task integrationTest(type: Test) {
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = sourceSets.integrationTest.runtimeClasspath
outputs.upToDateWhen { false }
}
// ...
dockerCompose.isRequiredBy(integrationTest)
dockerCompose {
useComposeFiles = [rootProject.file('src/test/resources/compose.yml').absolutePath]
executable = '/usr/local/bin/docker-compose'
dockerExecutable = '/usr/local/bin/docker'
}
当我从Intellij运行docker compose时,如何让单个测试首先进行docker compose
[1] :除非我从终端手动启动docker compose,否则请小心使用src/test/resources
中的一个,而不是src/main/resources
中的一个,因为它们指向两个不同的数据库,我认为测试清除了测试数据库