8 July, 2010
0 Comments
1 category
If you want to enable or disable unit tests in Microsoft Visual Studio 2010, you can use the “Ignore” attribute.
This can be used to ignore ore exclude integration tests in a nightly continuous integration build.
using System; using System.Text; using System.Collections.Generic; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Rvl.Demo.Test { [TestClass] public class UnitTest1 { [TestMethod] [Ignore] public void TestMethod1() { // This unit test will be excluded (ignored) from the test runs } } }
Category: Uncategorized
Nice example.
The only thing to add:
E.g. you call a method in the test that doesn’t exist and use the [Ignore] there will still be a compiler error!
It ignores the test while running them but it doesn’t ignore the test while compiling!