在空手道测试框架中,$ 不打印 json 响应
In karate testing framework, $ does not print the json response
使用 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”,$
只是为了方便 JsonPath 表达式:https://github.com/intuit/karate#jsonpath-short-cuts
使用 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”,$
只是为了方便 JsonPath 表达式:https://github.com/intuit/karate#jsonpath-short-cuts