WatiN 测试和连接字符串惨败
我有一个执行等待测试的单独项目。该项目采用类库项目的形式。当我运行测试时,它会启动浏览器,然后使用我正在测试的 Web 应用程序项目的 Web.config。 Web 应用程序项目的 Web.config 具有不应用于测试的 Dev 连接字符串。
我可以采取哪些不同的方式告诉我的 WatiN 使用 WatiN 项目内部的 App.config 而不是 Web 应用程序项目?
以下是我有的几个选项:
1)在运行时替换连接字符串。 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
以下是我所做的:
在运行测试之前,有一些自定义代码会转到 Web.config 文件,然后将连接字符串从 DEV 切换到 TEST。
测试完成后又变回DEV!
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!
尝试使用这种方式复制整个配置文件(您可以调整它以在交换测试和 QA 连接字符串之前和之后进行)
http://www.hanselman.com/blog/ManagingMultipleConfigurationFileEnvironmentsWithPreBuildEvents.aspx
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