【发布时间】:2020-04-24 19:26:56
【问题描述】:
我有一个 API 的响应是 JSON 数组的场景。下面我给出了一个 JSON 响应示例,其中“测试”是整个数组中可用的关键。所以我必须写到 Feature 步骤,我应该在一个步骤中使用 null 和正则表达式验证值。如果我正在验证 reg exp 并且值为 null 或反之亦然。步骤失败。
例如:
* match each $..test== '#regex ^[ A-Za-z0-9-]*$'
* match each $..test== null
我尝试了以下步骤,但失败了。
* match each $..test== '#regex ^[ A-Za-z0-9-]*$' | test == null
"response": [
{
"test": "Anand07"
},{
"test": null
},{
"test": "Archu06"
}]
感谢您的帮助。
【问题讨论】:
标签: selenium automated-tests cucumber karate web-api-testing