TA的每日心情 | 开心 2017-9-6 16:00 |
---|
签到天数: 2 天 连续签到: 2 天 [LV.1]测试小兵
|
以前的版本TEST右边的断言是这个格式的 tests["Status code is 200"] = responseCode.code === 200;
现在变成了pm.test("Status code is 200", function () {
pm.response.to.have.status(200);
});
看着难受死了。。。
怎么样调回旧的格式?
以下是官方文档,麻烦英文好的同学们看下,我是没找到怎么换回来
The older style of writing Postman tests relies on setting values for the special tests object. You can set a descriptive key for an element in the object and then say if it’s true or false. For example, tests["Body contains user_id"] = responsebody.has("user_id"); will check whether the response body contains the user_id string.
You can add as many keys as needed, depending on how many things you want to test for. Under the Tests tab under the response viewer, you can view your test results. The tab header shows how many tests passed, and the keys that you set in the tests variable are listed here. If the value evaluates to true, the test passed. |
|