【发布时间】:2018-11-03 05:22:02
【问题描述】:
我正在查看空手道文档: https://github.com/intuit/karate#command-line
我的文件如下:
跑步者类:
import org.junit.runner.RunWith;
import com.intuit.karate.junit4.Karate;
import cucumber.api.CucumberOptions;
@RunWith(Karate.class)
@CucumberOptions(features = "classpath:feature/country.feature")
public class APITest {}
把它放到我的 build.gradle 中:
test {
// pull cucumber options into the cucumber jvm
systemProperty "cucumber.options", System.properties.getProperty("cucumber.options")
// pull karate options into the jvm
systemProperty "karate.env", System.properties.getProperty("karate.env")
// ensure tests are always run
outputs.upToDateWhen { false }
}
我正在尝试像这样运行 gradle:
./gradlew test -Dtest=APITest
但我收到了这样的回复:
Rafaels-MacBook-Pro:TestProject rafaelpaz$ ./gradlew test -Dtest=APITest
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:compileTestJava
:processTestResources UP-TO-DATE
:testClasses
:test
但是,我看不到我的测试是否通过。我做错了什么?
Gradle 版本:2.14.1
【问题讨论】:
-
您确定您拥有运行单个测试的语法权限吗:stackoverflow.com/questions/22505533/…
-
@PeterThomas 再次感谢您帮助彼得,我之前尝试过这些命令并且我能够成功,但只有使用 JUnit,使用空手道我会收到如下错误:
FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':test'. > No tests found for given includes: [org.gradle.APITest] * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.这是我我做错了,但仍然没有意识到是什么 -
对不起,我帮不上忙。男人请切换到maven。我将再次在 Twitter 上寻求帮助
-
@PeterThomas 所有好伙伴,感谢您的帮助!我仍然会进行更多测试!干杯
标签: java gradle build.gradle gradlew karate