I am testing a quite big project (C#, VS2012), and I need to arrange my unit test in test hierarchy (eg.: now I have 43 test cases). I do really need the hierarchy.
I have test categories defined already, and the test explorer shows test cases by traits. I have categories in this way (one test have several categories)
Defined like this:
[TestMethod]
[TestCategory("MainTestType")]
[TestCategory("SubTestType")]
[TestCategory("SubsubTestType")]
public void MyTestCase()
{ /* etc. */
But Test Explorer shows the next:
So I really miss the hierarchy. I have tried "Cat1\Cat2\Cat3" or even with /. But no hierarchy displayed. Do you know how to do it, or a free addon which can do it for me?
I also will need these type of categorization, because we run often tests from command line, and mstest.exe can run tests for one category (eg all MainTestType, or SubTestType). (I stick to mstest because half of the team uses vs2010). But the solution is enough for vs2012.
Thank you in advance.
Tests can be run from Test Explorer by right-clicking in the code editor on a test and selecting Run test or by using the default Test Explorer shortcuts in Visual Studio. Some of the shortcuts are context-based. This means that they run or debug tests based on where your cursor is in the code editor.
Test category means one type of test or group of tests specified by rule under sub. (4) for similar materials or classes of materials or which utilize similar methods or related methods.
To start debugging: In the Visual Studio editor, set a breakpoint in one or more test methods that you want to debug. Because test methods can run in any order, set breakpoints in all the test methods that you want to debug. In Test Explorer, select the test method(s) and then choose Debug on the right-click menu.
Why We Shouldn't Test Private Methods. As a rule, the unit tests we write should only check our public methods contracts. Private methods are implementation details that the callers of our public methods aren't aware of. Furthermore, changing our implementation details shouldn't lead us to change our tests.
As what I searched for is not supported at the moment, I made the next workaround:
I used .trx because that way I don't have to do parse the assembly, mstest.exe does it. Test categories are made this way:
[TestCategory("MainTestType")]
[TestCategory("MainTestType/SubTestType")]
[TestCategory("MainTestType/SubTestType/SubsubTestType")]
So the is the workaround which is simple, only one binary and the developers can use too. The problem with playlist was that they aren't hierarchical neither.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With