[英]Run Visual Studio Unit Tests vs Run ReSharper Unit Tests, differences?
So I have been running into all kinds of interesting problems in VisualStudio 2008 when running Unit Tests. 因此,在运行单元测试时,我在VisualStudio 2008中遇到了各种有趣的问题。
Such as, when running Visual Studio Unit Tests some tests are failing together but passing individually. 例如,在运行Visual Studio单元测试时,某些测试会一起失败,但会单独传递。 This is happening because some class level variables in that test class is being reused in the Unit Tests.
发生这种情况是因为该测试类中的某些类级变量正在单元测试中重用。
Now normally I would go into each class and fix this problem manually! 现在通常我会进入每个班级并手动修复此问题! However, we are talking about tests that range in the thousands!
但是,我们正在讨论的测试数量达到数千个!
Now here comes the interesting dilemma, using both ReSharper Unit Tests and TFS BuildServer they are passing together! 现在有了一个有趣的困境,使用ReSharper单元测试和TFS BuildServer一起传递!
Is there any way that I could configure the VS Unit Test Solution to run in the same fashion? 有没有什么方法可以配置VS单元测试解决方案以相同的方式运行? I want to avoid calling the [TestInitialize] methods in the [TestCleanup] methods.
我想避免在[TestCleanup]方法中调用[TestInitialize]方法。
This is usually a byproduct of differently ordered tests. 这通常是不同排序测试的副产品。 ReSharper 4.x and earlier runs unit tests based on the order they appear in the source file.
ReSharper 4.x及更早版本根据它们在源文件中出现的顺序运行单元测试。 Almost all other unit test runners run tests in alphabetical order.
几乎所有其他单元测试运行器都按字母顺序运行测试。 This different ordering can (but never should) affect whether or not tests pass/fail (based on left over data in a database or statics).
这种不同的排序可以(但绝不应该)影响测试是否通过(基于数据库中的剩余数据或静态)。
ReSharper 5.0 is not using a custom runner anymore so it should fix these inconsistencies. ReSharper 5.0不再使用自定义运行器,因此它应该修复这些不一致性。
However, this type of inconsistency indicates a problem in the tests. 但是,这种不一致表明测试中存在问题。 Some are leaving data behind that they should be cleaning up and some are dependent on, or hurt by, data left over from a previous test.
有些人留下了数据,他们应该清理,有些人依赖于先前测试留下的数据,或者受到以前测试遗留的数据的影响。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.