如何 运行 使用命令行在 Gradle 上进行空手道测试

How to run Karate Test on Gradle Using Command line

我正在查看空手道文档: https://github.com/intuit/karate#command-line

我的文件如下:

亚军class:

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

https://github.com/SreecharanShroff/demos/blob/master/gradle_karate_demo.zip 有一个有效的 gradle 空手道演示项目,请根据您的要求更改 .feature 文件。 使用:

gradle 清理测试

如果您需要更多信息,请告诉我

谢谢,

Sreecharan Shroff