Parameterize the Url strings during webtests

时间:2016-02-12 21:35:08

标签: c# visual-studio-2015 performance-testing load-testing web-performance

I am testing an application locally and on remote machines using web tests in visual studio 2015.(2 weeks of experience with testing in visual studio) It worked fine for the local machine. But now I am hosting the application on Azure and I need to parameterize the URLs for all the tests. In other words, I need to change the Url value inside the xml from "http://localhost:23405/create" to "http://something.cloudapp.azure.com:23405/create" What's the best way to do this?

1 个答案:

答案 0 :(得分:0)

Web测试编辑器的命令图标之一是“参数化Web服务器”。这会更改请求中的URL以使用上下文参数。因此,http://localhost:23405/create之类的网址已更改为{{webserver1}}/create,并且已创建上下文参数webserver1并设置为http://localhost:23405。使用该命令时,可以更改名称webserver1。然后可以更改context参数的值以将测试更改为使用其他URL。

不幸的是,该命令未找到URL的所有用途。某些网址(例如StringBody和类似字段中的网址)会被遗漏。某些网址在其他字段中进行编码(例如,字符\:被其十六进制代码替换)并且可能会错过它们。