shwqdzh 发表于 2017-10-31 09:38:26

问个POSTMAN的问题

以前的版本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.

Miss_love 发表于 2017-11-1 09:52:24

支持调回?换回老版本吧。

让测试飞起来 发表于 2017-11-15 16:40:57

编写邮件测试的旧风格依赖于为特殊测试对象设置值。您可以为对象中的一个元素设置一个描述性关键字,然后再声明它是否为真或假。例如,测试[“体内含有user_id”] = responsebody。有(“user_id”);将检查是否响应正文包含user_id字符串。

您可以根据需要添加多个键,这取决于要测试的内容有多少。在“响应查看器”下的“测试”选项卡下,可以查看测试结果。选项卡头显示了多少测试通过,并且您在测试变量中设置的键列在这里。如果值为true,则测试通过。
页: [1]
查看完整版本: 问个POSTMAN的问题