用gradle运行单一集成测试 [英] run single integration test with gradle
问题描述
我试图使用gradle的 -Dtest.single
标志运行单个集成测试。我添加了另一个源集, src / integrationTest
,并将测试放在那里。我有一个集成测试任务
任务集成测试(类型:测试){
dependsOn 'assemble','integrationTestClasses'
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = sourceSets.integrationTest.runtimeClasspath
}
运行良好,但是如果我尝试运行单个测试,它会告诉我它找不到匹配的测试。我不想每次编写新的集成测试都要运行每个集成测试。有没有办法做到这一点?
正确的语法是:
gradle testTaskName -DtestTaskName.single = ...
在这种情况下:
gradle integrationTest -DintegrationTest.single = ...
I'm trying to run a single integration tests using gradle's -Dtest.single
flag. I have added another source set, src/integrationTest
and put the tests in there. I have an integration test task
task integrationTests(type: Test) {
dependsOn 'assemble', 'integrationTestClasses'
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = sourceSets.integrationTest.runtimeClasspath
}
This runs fine, but if I try to run a single test it tells me it cannot find a matching test. I don't want to have to run every integration test each time I am writing a new one. Is there a way to do this?
The correct syntax is:
gradle testTaskName -DtestTaskName.single=...
In this case:
gradle integrationTest -DintegrationTest.single=...
这篇关于用gradle运行单一集成测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!