mardi 17 octobre 2006 22:35
I am trying to run a webtest (using MSTEST) which I am using as part of a setup program (in C#). Everytime I run the setup program, I wanted to run webtest with different context param values e.g server url. Is there a way to pass and modify the webtest context param values in my setup program?
Toutes les réponses
mardi 17 octobre 2006 23:54
Great Question!!! :)
I have been trying to do this for a while.
In short I dont think there is a way.
However it is posible to write web test plugins that run before the web test, so you could
write to a file
then inside the plug-in read from that file and set the contex variables.
The problem is you have to have a constant file name that both have to know about.
If you find a better way please post!
mercredi 18 octobre 2006 00:29Modérateur
That's one way, thanks for posting it jakeb16. Another is that you can set context parameters from environment variables using and environment variable with the syntax Test.ContextParameterName, where ContextParameterName is the name of your context parameter. So from your setup program you would need to set the context parameters into the environment before running the test.
mercredi 18 octobre 2006 15:45
Thanks for the reply, all.
I was able to do what I want using Ed's suggestion of setting environment variables. I think this way is easier and cleaner.
jeudi 19 juillet 2012 14:32
It seems crazy that 6 years later, there still doesn't appear to be an easy way to define a "shared context parameter". If you are tuning in now, the workaround I just tripped over was to add an XML file to the project like below, then use a datasource in the individual tests to pull values from that file.