简体   繁体   English

nunit 3 / resharper未检测到项目中的所有测试

[英]nunit 3/resharper is not detecting all tests in a project

I am attempting to upgrade our solution from nUnit 2.6.4 to 3.8.0. 我正在尝试将我们的解决方案从nUnit 2.6.4升级到3.8.0。 The solution contains many projects some of which are test projects. 该解决方案包含许多项目,其中一些是测试项目。 My goal is to upgrade one project per commit to aid code reviews (we have around 12k of tests). 我的目标是在每次提交时升级一个项目,以帮助进行代码审查(我们有大约12k的测试)。

The problem I have is that one project contains around 500 tests, but when the resharper test runner runs on the project it only tests and runs 8 of these tests. 我的问题是,一个项目包含约500个测试,但是当reshaper测试运行程序在该项目上运行时,它仅测试并运行其中8个测试。 I have installed the nUnit 3 test adapter for that solution.If I rebuild it will pick up on the missing tests in the test session but as soon as I run them, they disappear. 我已经为该解决方案安装了nUnit 3测试适配器,如果我重建它,它将在测试会话中找到丢失的测试,但是一旦我运行它们,它们就会消失。 I did notice that some of the test fixtures in this project used the [TestFor()] attribute without the [Test] attibute and some text fixture classes didn't have [TestFixture] attribute, however adding this did not help. 我确实注意到,该项目中的某些测试装置使用了[TestFor()]属性,但没有[Test]属性,并且某些文本装置类没有[TestFixture]属性,但是添加此方法没有帮助。 The test fixtures do inherit from a base class in another project. 测试装置确实从另一个项目的基类继承。

I have ensured that resharper has the support for nUnit 3.X tick box and have ensured that in Test -> Options the assemblies are set to target x64. 我确保resharper支持nUnit 3.X复选框,并确保在Test-> Options中将程序集设置为目标x64。

Is there anything else I can do? 我还能做些什么吗?

I discovered the answer, most of my tests actually did have a dependency on one other project that handled a mock database we use for unit testing. 我找到了答案,我的大多数测试实际上确实依赖于另一个项目,该项目处理了我们用于单元测试的模拟数据库。 This project needed to be updated to support 3.8.0. 该项目需要更新以支持3.8.0。 I still have a few missing unit tests in this project but I expect that is explained by Rob Prouse's comment where some tests have [TestFor] without a [Test] attribute. 我在这个项目中仍然缺少一些单元测试,但是我希望这可以由Rob Prouse的评论来解释,其中一些测试具有[TestFor]属性,但没有[Test]属性。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM