在空手道测试框架中,$不打印json响应



使用https://github.com/intuit/karate,使用下面的简单脚本,响应变量会打印在控制台上,但$快捷方式不会。

编写脚本

Given url 'http://reqres.in/api/users/2'
When method GET
Then status 200   
* print "Hello, world!"
* print response
* print $

输出

[ForkJoinPool-10-worker-3] 16:33:36.642 [print] Hello, world!
[ForkJoinPool-10-worker-3] 16:33:36.643 [print] {
"ad": {
"company": "StatusCode Weekly",
"text": "A weekly newsletter focusing on software development, infrastructure, the server, performance, and the stack end of things.",
"url": "http://statuscode.org/"
},
"data": {
"last_name": "Weaver",
"id": 2,
"avatar": "https://s3.amazonaws.com/uifaces/faces/twitter/josephstein/128.jpg",
"first_name": "Janet",
"email": "janet.weaver@reqres.in"
}
}
[ForkJoinPool-10-worker-3] 16:33:36.644 [print]

根据https://github.com/intuit/karate#response,我希望美元能作为回应的参考。

打印必须"纯JS";,CCD_ 1仅对于JsonPath表达式是便利的:https://github.com/intuit/karate#jsonpath-捷径

最新更新