Value not substiuting in Postman Runner Collection

别说谁变了你拦得住时间么 提交于 2019-12-25 07:21:35

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/39842552/value-not-substiuting-in-postman-runner-collection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!