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

Raf*_*Paz 2 java gradle gradlew build.gradle karate

我正在查看空手道文档: 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 {}
Run Code Online (Sandbox Code Playgroud)

将其放入我的 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 }
}
Run Code Online (Sandbox Code Playgroud)

我正在尝试像这样运行 gradle:

./gradlew test -Dtest=APITest
Run Code Online (Sandbox Code Playgroud)

但我得到这样的回应:

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
Run Code Online (Sandbox Code Playgroud)

但是,我看不到我的测试是否通过。我究竟做错了什么?

摇篮版本:2.14.1

Sre*_*off 5

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

等级清洁测试

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

谢谢,

斯里查兰·史罗夫