is there a way to use categories and ordered tests in MSTest together?
[TestMethod, TestCategory("UITest")]
public void TestMethod()
{
}
and add a new ordered test to my test project.
well .. calling this method from the command line like:
MSTest.exe /testcontainer:MyOrderedTest.orderedtest
it will execute the testmethod.
but when calling MSTest like the following:
MSTest.exe /testcontainer:MyOrderedTest.orderedtest /category:UITest
it can't find the testmethod..
strange behavior ..
is there a way to do this?
When you use the
/testcontainer:[file name]option you tell MSTest to run the tests that are specified in this file. So, your unit test with the attribute[TestMethod, TestCategory("UITest")]will not run because it not contained inside theMyOrderedTest.orderedtest.You could create a
TestListto achieve this behavior which will contain all of your Tests that belong to theUITestcategory and also theOrderedTestand then run the following command: