价值不能在Postman Runner Collection中取代 [英] Value not substiuting in Postman Runner Collection
问题描述
我试图执行REST Webservice与来自csv文件在Postman Runner集合中的多个输入,但在URL参数我的csv值不是替换。我跟着同样的例子,即使这不工作 - http://blog.getpostman.com/2014/10/28/using-csv-and-json-files-in-the-postman-collection-runner/ p>
当我生成报告文件时,我看到的URL请求是这样
_http:// dump.getpostman.com/get?username = {{username}}& password = {{password}}
而不是
_http://dump.getpostman.com/get?username = ankith& password = abc
看起来URL是什么意思?如果有人可以帮助我解决这个问题,未获得{{username}}和{{password}}。只是确保两个值都存储在环境变量中。
由于您使用csv文件读取数据,以下代码可能会帮助您:
postman.setEnvironmentVariable 'username',data ['usrName']); //假设usrName将是csv文件中用户名条目的列名
postman.setEnvironmentVariable('password',data ['passwd']); //假设passwd将在csv文件中的密码条目的列名
您需要在 Pre -request脚本。
预请求脚本在测试用例执行之前执行
I'm trying to execute REST Webservice with multiple input from csv file in Postman Runner collection, but in URL param my csv value is not substituting. I followed the same example even that's not working - http://blog.getpostman.com/2014/10/28/using-csv-and-json-files-in-the-postman-collection-runner/
When I generate the report file - I'm seeing the URL request is going like this
_http://dump.getpostman.com/get?username={{username}}&password={{password}}
instead of
_http://dump.getpostman.com/get?username=ankith&password=abc
What I'm missing here, why actual value is not taking from csv file, it would be really appreciated if someone can help me to fix this issue
It seems that URL is not getting {{username}} and {{password}}. just make sure that both values are getting stored in environment variable or not. As you are using csv file to read data the following piece of code may help you:
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
You need to write this script in Pre-request Script in postman request. Pre-request Script executes before test case execution
这篇关于价值不能在Postman Runner Collection中取代的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!