Karate 为分页端点编写空手道

Karate 为分页端点编写空手道,karate,Karate,如何编写分页端点的空手道 Scenario: Get Students Pagination - returns 200 Given path 'student?direction=ASC&isPagination=true' When method GET Then status 200 我得到的错误 com.intuit.karate.exception.KarateException: status code was: 404, expected: 20

如何编写分页端点的空手道

Scenario: Get Students Pagination - returns 200

    Given path 'student?direction=ASC&isPagination=true'
    When method GET
    Then status 200
我得到的错误

com.intuit.karate.exception.KarateException: status code was: 404, expected: 200, response time: 9, url: http://localhost:8080/studentss%3Fdirection=ASC&isPagination=true&page=0&size=10, response: <!doctype html><html lang="en"><head><title>HTTP Status 404 – Not Found</title><style type="text/css">h1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} h2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} h3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} body {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} b {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} p {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;} a {color:black;} a.name {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 404 – Not Found</h1></body></html>
    at com.intuit.karate.StepDefs.status(StepDefs.java:480)
    at ✽.Then status 200(feature/local/Student.feature:49)

我认为您没有调用正确的url。 是http://localhost:8080/studentss%3Fdirection=ASC&isPagination=true&page=0&size=10 当您在浏览器上转到此url时,是否返回404以外的内容


我猜您重定向的url中的studentss有问题。

我认为您调用的url不正确。 是http://localhost:8080/studentss%3Fdirection=ASC&isPagination=true&page=0&size=10 当您在浏览器上转到此url时,是否返回404以外的内容


我猜你重定向的url中的studentss有问题。

空手道会自动对路径进行url编码

因此,请使用关键字添加url参数

就你而言:

Scenario: Get Students Pagination - returns 200

    Given path 'student'
    * param direction = 'ASC'
    * param isPagination = 'true'
    When method GET
    Then status 200

在构建更复杂的路径之前,请务必阅读。

空手道会自动对路径进行url编码

因此,请使用关键字添加url参数

就你而言:

Scenario: Get Students Pagination - returns 200

    Given path 'student'
    * param direction = 'ASC'
    * param isPagination = 'true'
    When method GET
    Then status 200
在构建更复杂的路径之前,请务必阅读。

我已经配置了config.baseUrl=http://localhost:8080/ 对于其他测试类,其工作正常。还有其他指针吗?我已经配置了config.baseUrl='1!'http://localhost:8080/ 对于其他测试类,其工作正常。还有其他的指示吗?