首页 > 解决方案 > 无法运行空手道测试

问题描述

我无法在我的功能中运行空手道测试

package api;
import com.intuit.karate.junit4.Karate;
import org.junit.runner.RunWith;
@RunWith(Karate.class)
public class PagesRunner {
}

这是生成的报告

我的功能文件:

Feature: some Adaptor Request Success

Background:
* def myUrl = baseURL
* configure headers = read('classpath:some-headers.js')
Scenario: Some Adaptor Success
* def someInitiate= read('classpath:requests/someRequest.json')
* url myUrl
Given path 'api/somerequest'
And request someInitiate
When method post
Then status 202

不知道我在这里缺少什么。对 api 自动化世界来说非常新。任何帮助深表感谢。

标签: karate

解决方案


我建议您按照快速入门示例开始。

https://github.com/intuit/karate#quickstart

mvn archetype:generate \
-DarchetypeGroupId=com.intuit.karate \
-DarchetypeArtifactId=karate-archetype \
-DarchetypeVersion=0.8.0 \
-DgroupId=com.mycompany \
-DartifactId=myproject

然后尝试运行UsersRunner.java| users.feature没有问题。然后,您可以在此基础上进行构建。


推荐阅读