Karate 空手道API-为什么不返回调用的功能文件
我通过传递un、pwd和端点url,从后台标签下的另一个特性调用登录特性,如下所示。登录功能正在成功运行,但其响应不会返回到被调用的功能文件Karate 空手道API-为什么不返回调用的功能文件,karate,Karate,我通过传递un、pwd和端点url,从后台标签下的另一个特性调用登录特性,如下所示。登录功能正在成功运行,但其响应不会返回到被调用的功能文件 @Add Feature: Adding products Background: * table loginDetails | username | password | endPointURL | | 'kUser' | 'kPass' | 'https://qa1.com/shop
@Add
Feature: Adding products
Background:
* table loginDetails
| username | password | endPointURL |
| 'kUser' | 'kPass' | 'https://qa1.com/shop/login/login' |
* def result = call read('Login.feature') loginDetails
* print 'Result-'+response
* print 'Result-'+result.response
@loginTest
Scenario: running @loginTest from runner file
* print 'Login response -'+result.responseCookies
这就是我得到的回应
13:08:53.470 [main] INFO com.intuit.karate - [print] {
"redirect": false,
"loginSuccess": true,
"redirectUrl": ""
}
13:08:53.519 [main] INFO com.intuit.karate - [print]
13:08:53.546 [main] INFO com.intuit.karate - [print] RUResult-undefined
13:08:53.547 [main] INFO com.intuit.karate - [print] Login response -undefined
当您将数据表/JSON数组传递给被调用的特性时,您将得到JSON数组作为回报 在这里,结果对象将具有类似JSON数组/列表的数据,所以您必须相应地读取该变量 对于上面的示例,请尝试
* print result[0].response
* print result[0].responseCookies
当您将数据表/JSON数组传递给被调用的特性时,您将得到JSON数组作为回报 在这里,结果对象将具有类似JSON数组/列表的数据,所以您必须相应地读取该变量 对于上面的示例,请尝试
* print result[0].response
* print result[0].responseCookies
谢谢你的快速回复。这对我很有效。谢谢你的快速回复。这对我有用。