views:

25

answers:

2

I have a separate project which performs watiN tests. The project is in the form of class library project. When I run test it launches the browser and then uses the Web.config of the Web Application Project which I am testing. The Web.config of web application project has the Dev connection string which should not be used for testing.

What are different ways that I can take and tell my WatiN to use the App.config that is inside the WatiN project and not the Web application project?

Here are couple of options that I have:

1) Replace the connection string at runtime. 2) Replace the connection string at pre-build event or something.

A: 

Here is what I did:

Before a test is run there is some custom code that goes to the Web.config file and then switches the connection string from DEV to TEST.

After the test is completed it changes it back to DEV again!

azamsharp
A: 

Try using this way of copying your whole config file (you can tweak it to do it before & after to swap the test & QA connections strings)

http://www.hanselman.com/blog/ManagingMultipleConfigurationFileEnvironmentsWithPreBuildEvents.aspx

Shady M. Najib