Reputation: 2086
I have been tasked with repairing our decrepid unit test framework and I'm simply trying to disable a few failing tests, but I don't know how to do this in code. In C#, it's as simple as adding the [Ignore] attribute and, in C++, I figured out how to disable all of them for a particular class, but I want to do it with specific tests as well:
BEGIN_TEST_CLASS_ATTRIBUTE()
TEST_CLASS_ATTRIBUTE(L"Ignore", L"true")
END_TEST_CLASS_ATTRIBUTE()
Does anyone know how to disable a specific unit test in a source file in C++ using the MSTest framework? Thanks in advance, Google has not been of much help!
Upvotes: 2
Views: 1503
Reputation: 54
You can do this:
BEGIN_TEST_METHOD_ATTRIBUTE(Test_Name)
TEST_METHOD_ATTRIBUTE(L"Ignore", L"true")
END_TEST_METHOD_ATTRIBUTE()
TEST_METHOD(Test_Name)
{
// code
}
Or this:
BEGIN_TEST_METHOD_ATTRIBUTE(Test_Name)
TEST_IGNORE()
END_TEST_METHOD_ATTRIBUTE()
TEST_METHOD(Test_Name)
{
// code
}
Check More here
Upvotes: 4