简体   繁体   English

单元测试在Visual Studio中“全部运行”但单独传递时失败

[英]Unit Tests Fail when “Run All” in Visual Studio but passes individually

I am having this wierd problem with MOQ Unit tests. 我在MOQ Unit测试中遇到了这个奇怪的问题。

I have around 636 unit tests written using MOQ Framework in VS 2012. When I run them project-wise and/or individually, they pass successfully. 我在VS 2012中使用MOQ框架编写了大约636个单元测试。当我以项目方式和/或单独运行它们时,它们成功通过。 but whenever I select Run-All they fail randomly showing different errors. 但每当我选择Run-All时,它们都会随机显示不同的错误。

Most of the methods show IO.FileNotFoundException. 大多数方法都显示IO.FileNotFoundException。

I looked Here here and here but no clue yet. 这里这里看了一下 ,但还没有任何线索。

Edited : 编辑

I solved the problem of FileNotFoundException using DeploymentItem [] attribute. 我使用DeploymentItem []属性解决了FileNotFoundException的问题。

But still one of the project is failing when RunAll. 但是当RunAll时,其中一个项目仍然失败。 exception tells - " Cannot convert, incompatible types " on of the properties. 异常告诉 - 属性上的“ 无法转换,不兼容的类型 ”。

seems like I missed using DeploymentItem["NeededProject.dll"] for each unit test class. 好像我错过了为每个单元测试类使用DeploymentItem [“NeededProject.dll”]。 Its working fine now. 它的工作正常。 :) :)

暂无
暂无

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

相关问题 Flurl&HttpTest:单元测试在全部运行时失败,但在单独运行时通过 - Flurl & HttpTest: Unit tests fail when Run All, but pass when run individually 单元测试在一起运行时失败,单独传递 - Unit Tests fail when run together, pass individually 为什么使用HostType(“ Moles”)进行的单元测试中的断言在单独运行时可以通过,而在一组测试中运行时却失败? - Why would an assert on a unit test with HostType(“Moles”) pass when run individually, but fail when run with a group of tests? 单元测试在“全部运行”时失败,但在单次运行时通过 - Unit tests fail on Run All but pass when are run single 我正在尝试在Visual Studio中运行所有测试,但是当我运行测试时,第一个测试将通过,但所有其他测试将失败 - I am trying to run all tests in visual studio, but when I run the the tests the first one will pass, but all the others will fail Visual Studio不会在测试类中运行所有单元测试 - Visual Studio does not run all the unit tests in a test class 一起运行时单元测试超时,单独运行时成功吗? - Unit Tests timeout when run together, succeed when run individually? 在Visual Studio中运行应用程序时如何运行单元测试 - How to run unit tests when running the application in visual studio 在 Visual Studio 2013 中运行单元测试时运行其他项目 - Run other project when running unit tests in Visual Studio 2013 为什么我的测试一起运行时失败,但单独通过? - Why do my tests fail when run together, but pass individually?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM