**结束。**此问题需要详细的调试信息。它目前不接受答案。**想改进这个问题吗?**更新问题,使其成为堆栈溢出的主题。
两天前关门了。改进这个问题我试图运行一个通过空手道功能文件的基本信息api测试。<
6xfqseft1#
-----功能文件内容
smdncfj32#
-->
import com.intuit.karate.junit5.Karate; import com.intuit.karate.junit5.Karate.Test; //import com.intuit.karate.core. public class TestGetRunner { @Test public Karate runTest(){ return Karate.run("getRequest").relativeTo(getClass()); } }
我想我已经增加了所有的依赖性。但是在通过junit运行测试时,我遇到了一个错误:
1 < Connection: keep-alive [{"jobId":1,"jobTitle":"Software Engg","jobDescription":"To develop andriod application","experience":["Google","Apple","Mobile Iron"],"project":[{"projectName":"Movie App","technology":["Kotlin","SQL Lite","Gradle"]}]}] 18:53:27.126 [main] ERROR com.intuit.karate - classpath:com/api/automation/getrequest/getRequest.feature:5 When method get Could not initialize class com.intuit.karate.JsonUtils classpath:com/api/automation/getrequest/getRequest.feature:5
api工作正常,上面显示的json列表就是输出。但是在第5行,我得到了一个错误“couldnotinitializeclasscom.intuit.karate.jsonutils”。我可以看到jsonutils类可用。但不知道为什么它的对象不能被创建。我检查了空手道框架代码行。但是没有帮助。我是空手道自动化新手。如果有人知道,请帮忙!
u2nhd7ah3#
Feature: Relationship Service validation Scenario: Get drill-down nodes when filter has contains condition operator Given url 'http://localhost:9999/normal/webapi/all' When method get Then status 200
<
yftpprvb4#
我刚用不同的网址执行了你的代码 https://reqres.in/api/users/2 它对我有用。我的环境:
https://reqres.in/api/users/2
C:\>mvn -v Apache Maven 3.6.3 () Maven home: C:\apache-maven\bin\.. Java version: 14.0.2, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk-14.0.2 Default locale: en_US, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
输出:
C:\karateframeworktutorial-master-working>mvn clean test [INFO] Scanning for projects... [INFO] [INFO] -------------< com.api.automation:karateframeworktutorial >------------- [INFO] Building karateframeworktutorial 0.0.1-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ karateframeworktutorial --- [INFO] Deleting C:\karateframeworktutorial-master-working\target [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ karateframeworktutorial --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\karateframeworktutorial-master-working\src\main\resources [INFO] [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ karateframeworktutorial --- [INFO] No sources to compile [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ karateframeworktutorial --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 3 resources [INFO] [INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ karateframeworktutorial --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 2 source files to C:\karateframeworktutorial-master-working\target\test-classes [INFO] [INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ karateframeworktutorial --- [INFO] [INFO] ------------------------------------------------------- [INFO] T E S T S [INFO] ------------------------------------------------------- [INFO] Running com.api.automation.getrequest.TestGetRunner 12:53:38.712 [main] DEBUG com.intuit.karate.Suite - [config] classpath:karate-config.js 12:53:39.475 [main] INFO com.intuit.karate - karate.env system property was: null 12:53:39.742 [main] DEBUG com.intuit.karate - request: 1 > GET https://reqres.in/api/users/2 1 > Host: reqres.in 1 > Connection: Keep-Alive 1 > User-Agent: Apache-HttpClient/4.5.13 (Java/14.0.2) 1 > Accept-Encoding: gzip,deflate 12:53:40.054 [main] DEBUG com.intuit.karate - response time in milliseconds: 281 1 < 200 1 < Date: Thu, 22 Apr 2021 17:53:40 GMT 1 < Content-Type: application/json; charset=utf-8 1 < Transfer-Encoding: chunked 1 < Connection: keep-alive 1 < X-Powered-By: Express 1 < Access-Control-Allow-Origin: * 1 < Etag: W/"118-pbdwwFo9SKNhD3Lx5iHJyngpq00" 1 < Via: 1.1 vegur 1 < Cache-Control: max-age=14400 1 < CF-Cache-Status: HIT 1 < Age: 3340 1 < cf-request-id: 099c5065110000615851bba000000001 1 < Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" 1 < Report-To: {"max_age":604800,"group":"cf-nel","endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report?s=P4%2Bq0DOE555WKP3jOZmCrty4XBs1aCszh7CIoqXLwdtVCIIpFcKucIeRgq06UnrhrOmq%2FSCaMlhmAuZ%2BnYZoVPsV2cYjxUG1UpM%3D"}]} 1 < NEL: {"report_to":"cf-nel","max_age":604800} 1 < Vary: Accept-Encoding 1 < Server: cloudflare 1 < CF-RAY: 6440b681bf3f6158-ORD 1 < alt-svc: h3-27=":443"; ma=86400, h3-28=":443"; ma=86400, h3-29=":443"; ma=86400 1 < Set-Cookie: __cfduid=ddc5fe520d8c7faaa91efe44cc55007481619114020; Max-Age=1621706020000; Expires=Sat, 16 Feb 53411 08:20:20 GMT; Domain=reqres.in; Secure {"data":{"last_name":"Weaver","id":2,"avatar":"https:\/\/reqres.in\/img\/faces\/2-image.jpg","first_name":"Janet","email":"janet.weaver@reqres.in"},"support":{"text":"To keep ReqRes free, contributions towards server costs are appreciated!","url":"https:\/\/reqres.in\/#support-heading"}} --------------------------------------------------------- feature: classpath:com/api/automation/getrequest/getRequest.feature scenarios: 1 | passed: 1 | failed: 0 | time: 0.5520 --------------------------------------------------------- Karate version: 1.0.1 ====================================================== elapsed: 1.82 | threads: 1 | thread time: 0.55 features: 1 | skipped: 0 | efficiency: 0.30 scenarios: 1 | passed: 1 | failed: 0 ====================================================== HTML report: (paste into browser to view) | Karate version: 1.0.1 file:///C:/karateframeworktutorial-master-working/target/karate-reports/karate-summary.html =================================================================== [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.317 s - in com.api.automation.getrequest.TestGetRunner [INFO] [INFO] Results: [INFO] [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 5.417 s [INFO] Finished at: 2021-04-22T12:53:41-05:00 [INFO] ------------------------------------------------------------------------
nukf8bse5#
-----testcase runner类
5条答案
按热度按时间6xfqseft1#
-----功能文件内容
smdncfj32#
-->
我想我已经增加了所有的依赖性。但是在通过junit运行测试时,我遇到了一个错误:
api工作正常,上面显示的json列表就是输出。但是在第5行,我得到了一个错误“couldnotinitializeclasscom.intuit.karate.jsonutils”。我可以看到jsonutils类可用。但不知道为什么它的对象不能被创建。我检查了空手道框架代码行。但是没有帮助。我是空手道自动化新手。如果有人知道,请帮忙!
u2nhd7ah3#
-->
<
yftpprvb4#
我刚用不同的网址执行了你的代码
https://reqres.in/api/users/2
它对我有用。我的环境:
输出:
nukf8bse5#
-----testcase runner类