【发布时间】:2015-01-15 08:50:53
【问题描述】:
我有以下问题 - 我想用 Codeception 测试 REST api。
当我想确保在 JSON 响应中我有数组时:
'data' => [
'sth' => 'whathever'
]
我可以这样使用seeResponseJsonMatchesXpath:
$I->seeResponseJsonMatchesXpath('//data/sth');
但是如果我想确保我没有回应某事该怎么办?我想使用例如:
$I->seeResponseJsonMatchesXpath('//data');
$I->dontSeeResponseJsonMatchesXpath('//data/sth');
但显然 Codeception 中没有 dontSeeResponseJsonMatchesXpath 方法。
我也不知道sth 的确切值是多少,所以我可能无法在这里使用dontSeeResponseContainsJson。
问题是 - 如何进行以下检查?
【问题讨论】:
标签: rest testing xpath codeception