Visual Studio Load/Performance Tests - Parameterizing REST values in the URL

拥有回忆 提交于 2019-12-08 16:55:34

问题


I am starting out with Visual Studio 2012, and have been tasked with writing some load tests that hit REST services. Struggling because I'd like to parameterize a value that's in the URL, accessing a .csv file as a datasource.

For example, I'd like the URL to be http://staging.company.com/OrderService.svc/GetOrderInfo/{{OrderId}}

...and use a .csv file to iterate through a list of OrderId's.

There's a lot of info online about parameterizing values in the body of a request, and I've went through "Binding a Data Source to a Web Performance Test" here: http://msdn.microsoft.com/en-us/library/ms404707.aspx.

Am I just missing something obvious, or is there no way to do this?

Thanks.


回答1:


You are on the right path but for an obscure reason you can't bind context parameters to a datasource. Your only solution is to put the binding expression in the url like that :

 http://staging.company.com/OrderService.svc/GetOrderInfo/{{MyDataSource.MyTestData#csv.column1}}


来源:https://stackoverflow.com/questions/14166840/visual-studio-load-performance-tests-parameterizing-rest-values-in-the-url

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