[英]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.