开发者

WatiN Testing and Connection Strings Fiasco

开发者 https://www.devze.com 2023-01-01 10:35 出处:网络
I have a separate project which performs watiN tests. The project is in the 开发者_StackOverflowform of class library project. When I run test it launches the browser and then uses the Web.config of t

I have a separate project which performs watiN tests. The project is in the 开发者_StackOverflowform 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.


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!


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

0

精彩评论

暂无评论...
验证码 换一张
取 消