[英]How to Make a test method Not Runnable in Visual Studio Unit Test
How to Make a test method not runnable in Visual Studio Unit Test ? 如何使测试方法在Visual Studio单元测试中不可运行? using visual studio 2010 with .NET 4.0.
使用Visual Studio 2010和.NET 4.0。
Suppose I have 10 test methods out of which, 1 test method is not working due to external dependencies. 假设我有10种测试方法,其中1种测试方法由于外部依赖性而无法工作。 If I want to run all 10, then I will get error in one test.
如果我想要全部运行10,那么我将在一次测试中得到错误。
One solution is: Don't run the test. 一种解决方案是:不要运行测试。 But I need to know, is there any Attributes or anything like that, which simply bypasses the test and it will not be run.
但我需要知道,是否有任何属性或类似的东西,它只是绕过测试而不会运行。
I tried with [WorkItem(1234)]
Attribute, but still the test is running. 我尝试使用
[WorkItem(1234)]
属性,但测试仍在运行。
Any help is greatly appreciated. 任何帮助是极大的赞赏。
Yes, you can add the Ignore
attribute to the test you want to skip: 是的,您可以将
Ignore
属性添加到要跳过的测试:
[TestMethod, Ignore]
public void ThisTestWontRun()
{
// Test code here
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.