首页 文章

Postman Runner Collection 中没有值的替代品

提问于
浏览
0

我正在尝试使用 Postman Runner 集合中的 csv 文件的多个输入执行 REST Webservice,但是在 URL 参数中我的 csv 值不是替换。我遵循相同的例子,即使这不起作用 - http://blog.getpostman.com/2014/10/28/using-csv-and-json-files-in-the-postman-collection-runner/

当我生成报告文件时 - 我看到 URL 请求是这样

_http://dump.getpostman.com/get?用户名= {{。 3}}&password = {{。 4}}

代替

_http://dump.getpostman.com/get?username=ankith&password=abc

我在这里缺少的,为什么实际价值不是来自 csv 文件,如果有人可以帮助我解决这个问题,我将非常感激

1 回答

  • 1

    看来 URL 没有得到{{。 1}}和{{。 2}}。只需确保两个值都存储在环境变量中。当您使用 csv 文件读取数据时,以下代码可能对您有所帮助:

    postman.setEnvironmentVariable('username',data['usrName']);//assuming usrName will be column name for username entries in csv file
    postman.setEnvironmentVariable('password',data['passwd']);//assuming passwd will be column name for password entries in csv file
    

    您需要在邮递员请求中以Pre-request Script编写此脚本。 Pre-request 脚本在测试用例执行之前执行

相关问题