Intellij:在各个测试运行中``docker-compose up`?

时间:2017-11-06 21:34:58

标签: java mongodb intellij-idea docker-compose spock

我无法使用播放按钮在Intellij 1 中运行单独测试,因为我们的集成测试需要mongo才能运行,但我可以使用{ {1}}标签用于运行所有集成测试,因为我们在Gradle中有以下内容:

build.gradle

当我从Intellij运行时,如何首先对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' } 进行单独测试?

[1]:除非我从终端手动启动docker-compose,否则要小心使用docker-compose up中的那个而不是src/test/resources中的那个,因为它们指向两个不同的数据库我认为,测试清除了测试数据库。

0 个答案:

没有答案