Reputation: 21
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?
Upvotes: 1
Views: 254
Reputation: 14038
One of the command icon with the web test editor is "Parameterize web servers". This changes the URLs in the requests to use context parameters. So a URL like http://localhost:23405/create
is changed to something like {{webserver1}}/create
plus the context parameter webserver1
is created and set to http://localhost:23405
. The name webserver1
can be altered when the command is used. The value of the context parameter can then be altered to change the test to use another URL.
Unfortunately the command does not find all uses of the URL. Some URLs, such as those in StringBody
and similar fields are missed. Some URLs are encoded in other fields (eg the characters \
and :
are replaced by their hex codes) and they may be missed.
Upvotes: 1