Home » Category » Microsoft Visual Studio

Microsoft Visual Studio: setting up web test and coded web test URL on different environment.

100| Wed, 26 Dec 2007 20:47:00 GMT| jagdeepsihota| Comments (2)

Help with setting up web test and coded web test on different environment. I have web test and some code generated web test and I need to run these web test on my dev box, test, and production.

For example

dev: http://192.168.111.50/flexcardma/CityList.aspx

Test: http://192.168.100.50/flexcardma/CityList.aspx

Prod: http://192.168.0.50/flexcardma/CityList.aspx

Is there way in Visual studio where I can set URL for all my web test and code generated web test for different environment?

I also have 3 different website I need to test so they all have different URL.

For example

Test site one: www.one.com

Test site two: www.two.com

Test site there: www.three.com

Keywords & Tags: setting, web, coded, url, different, environment, microsoft, visual studio

URL: http://www.cooldevelopers.com/visual-studio/83810/
 
«« Prev - Next »» 2 helpful answers below.

What I do is put the server name in a config file and change the config file when I need to switch enviorments

You can Add the following under the configuration Node

<appSettings file="C:\Projects\XCCB.PerformanceTesting\WebTests\WebTests.config">

Inside the following file

C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\VSTestHost.exe.config

This of course will use this new config file in all Visual Studio Tests but I only do one thing with Visual Studio.

Now inside the new config file you can create keys

<add key="PortalURL" value="http://xccbTest.companycom/"/>

Then inside my coded web test

I just add (you need to reference System.Configuration)

private const string PORTAL_URL_KEY = "PortalURL";

public static string PORTAL_URL = ConfigurationManager.AppSettings[PORTAL_URL_KEY];

Then when I call a test I do the following

WebTestRequest request1 = new WebTestRequest( PORTAL_URL+ "default.aspx");

request1.Method = "POST";

FormPostHttpBody request1Body = new FormPostHttpBody();

request1.Body = request1Body;

yield return request1;

Anyone have a better way of doing this?

-Jacob Blumberg

jakeb16 | Tue, 04 Sep 2007 15:32:00 GMT |

Another option is to use the parameterize server functionality in a web test. This lets yuo pull the server information out our the url so that you can control it from one property.

http://msdn2.microsoft.com/en-us/library/ms184806(VS.80).aspx

slumleymsft | Tue, 04 Sep 2007 15:33:00 GMT |

Microsoft Visual Studio Hot Answers

Microsoft Visual Studio New questions

Microsoft Visual Studio Related Categories