NUnit GUI 运行器多个配置文件
我使用 web.config 文件创建了一个测试项目,将其重命名为与项目相同的名称,将其复制到 bin 文件夹并将 NUnit GUI 运行器的配置文件名设置为我的配置文件的名称。现在我想向该项目添加更多程序集,但这里的问题是每个程序集都有自己的 web.config 文件。
如何设置程序集的配置文件,因为我需要从这些配置文件中获取连接字符串,并考虑在加载多个程序集时它们需要位于同一目录中
I created a test project using a web.config file by renaming it to same name as the project, copying it to the bin folder and setting the Configuration File Name of the NUnit GUI runner to the name of my config file. Now I want to add more assemblies to this project but the problem here is each assembly has it's own web.config file.
How can I set the configuration files for the assemblies because I need to get my connection strings from these config files and considering when loading multiple assemblies they need to be in the same directory
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
虽然我觉得使用配置文件进行 NUnit 测试是禁忌(我假设这是一个集成测试),但您可以尝试多种方法:
如果您将不同的 Web 应用程序加载到同一目录中(正如您所说的您正在访问 web.config 文件 - 这意味着 Web 应用程序),那么您的生活就会变得困难。每个应用程序都必须有自己的文件夹和虚拟目录,以及仅特定于该应用程序的 web.config。
While I feel that using config files for NUnit tests is a no-no (it's an integration test, in that case, I assume), there are various approaches you can try:
If you are loading different web applications into the same directory (as you're saying you're accessing web.config files -- which means web applications) then you're making your life difficult. Each application has to have their own folder and virtual directory, and a web.config specific to only that application.