-2

I can able to set or modify context parameter in VS webtest via command prompt.

Command used in command prompt to change the context parameter in Visual studio webtest: Set Test.URL="http://google.com".

Kiruthik
  • 17
  • 7
  • I do not understand you question now you have edited it. What exactly to do want to do? What have you already tried? What did it do (or not do)? – AdrianHHH Jan 08 '18 at 09:33
  • @AdrianHHH Consider we have a sample.webtest file which we have scripted in VS. In sample.webtest, url mentioned in context parameter is 'http://X' If we run the webtest, It ll run the corresponding url 'http://X'. Now requirement is -> From powershell,I should change the Url say 'http://Y' in context parameter and execute.Hope you cleared your queries. – Kiruthik Jan 08 '18 at 11:34
  • Completely unclear. How are you invoking the web tests and how are you invoking the Powershell? Are you trying to do three manual operations in order, namely (1) run the web test with `X` then (2) run Powershell then (3) run a modified web test? Or what. Please [edit] the question to explain in detail what you are trying to do. – AdrianHHH Jan 08 '18 at 20:40
  • Please [edit] the question to add extra details, do not write an answer that is not an answer. See the [edit] link just below the tags of the question. I still do not know what you are trying to do. How are you wanting to run the two tests and how to run the Powershell? My previous question were intended to help you write a question that can be understood and thus can be answered. But you are not providing any answers or any useful details. If this question is important to you then please put some significant effort into writing a good question. – AdrianHHH Jan 09 '18 at 10:21

2 Answers2

0

An environment variable with name starting "Test." will be copied to context parameter. For example if the environment variable Test.ForWebTest is set to the value ForMyWebTest then the Visual Studio web test context parameter ForWebTest will be set to the value ForMyWebTest.

See here for additional details.

Remember that the environment variable must be set before the test starts and in an environment that the test will inherit.

AdrianHHH
  • 13,492
  • 16
  • 50
  • 87
0

Should run

"setx Test.WebServer1 "http://www.google.com" -m"

in powershell to change the value of context parameter in webtest.Once after running the above command,close and open the powershell and try running the .MSTEST.exe. Post if any queries.

Kiruthik
  • 17
  • 7