简体   繁体   English

Resharper测试运行程序在“全部运行”中找不到连接字符串

[英]Resharper test runner can't find connection string on Run All

I have a Visual Studio project structure something like this: 我有一个类似这样的Visual Studio项目结构:

Base (no connection string)
Data (connection string to Sql Server, references Base)
Logic (connection string to Sql Server, references Base & Data)
Base.Test (no connection string, references Base)
Logic.Test (connection string to Sql Server, references Base & Data & Base.Test)

When I use Resharper to run all the unit tests on each of the test projects separately, they pass. 当我使用Resharper在每个测试项目上分别运行所有单元测试时,它们通过了。 But when I run all unit tests across all projects, the Base tests pass first and then the Logic tests fail because it can't find the connection string. 但是,当我在所有项目中运行所有单元测试时,基础测试首先通过,然后逻辑测试失败,因为它找不到连接字符串。

When I debug, I can see it does actually have one connection string to SqlExpress, which I gather is being generated by Entity Framework, which seems to come from another project higher up the chain? 当我调试时,我可以看到它实际上有一个到SqlExpress的连接字符串,我收集到的是由Entity Framework生成的,它似乎来自于链上另一个项目?

How can I get the Logic.Test project to use its own connection string from app.config on Run All? 如何在Run All上从app.config中获取Logic.Test项目以使用其自己的连接字符串?

I believed I had a similar problem a long time ago, and I seem to remember I had to change some ReSharper settings ( ReSharper -> Tools -> Options | Tools | Unit testing ) 我相信很久以前就有类似的问题,而且我似乎还记得我不得不更改一些ReSharper设置( ReSharper > Tools -> Options | Tools | Unit testing

I'm checking my options right now, and I have Shadow-copy un-ticked and Separate AppDomain ticked. 我现在正在检查我的选项,并且没有选中卷影副本,并且选中了单独的AppDomain。

You should give it a try. 您应该尝试一下。

EDIT : 编辑

it seems just ticking the Separate AppDomain checkbox is sufficient, regardless of the Shadow-copy setting. 不管阴影复制设置如何,只要勾选“ 单独的AppDomain”复选框就足够了。

The alternative solution was to simply duplicate the app.config onto the Base.Test project. 另一种解决方案是将app.config复制到Base.Test项目中。 Not ideal as conceptually that project didn't relate to database work at all, but the solution did work in both the dev environments and TeamCity test runner. 从概念上讲该项目与数据库工作完全无关,这并不理想,但是该解决方案在开发环境和TeamCity测试运行程序中均有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Resharper 7:MSTest不工作​​ - “测试未运行” - Resharper 7: MSTest not working - “Test wasn't run” Resharper - 单元测试运行器无法运行测试(System.Runtime.Remoting.RemotingException) - Resharper - Unit Test Runner failed to run tests (System.Runtime.Remoting.RemotingException) Resharper Test Runner不会在VMWare Fusion共享文件夹中运行单元测试 - Resharper Test Runner wont run unit tests in VMWare Fusion shared folder Specflow Resharper测试运行器导航到功能文件 - Specflow Resharper test runner navigate to feature file 是否可以使用ReSharper作为测试跑步者? - Is it possible to use ReSharper as a test runner ONLY? 在Resharper中更改NUnit Test Runner中链接的颜色 - Change color of links in NUnit Test Runner in Resharper NUnit首先在Resharper测试运行器中使用Entity Framework测试非常慢 - NUnit first test very slow with Entity Framework in Resharper test runner 我如何使用 resharper 找到所有空捕获? - How can i find all empty catch with resharper? 如何通过ReSharper查找所有未使用using语句? - How can I find all unsed using statements with ReSharper? Resharper Unit Test Runner明显慢于NUnit控制台 - Resharper Unit Test Runner significantly slower than NUnit console
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM