For this code, test runner displays 'Empty category' when I use 'Category' grouping
C#using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTests
{
[TestClass]
public class UnitTest1
{
[TestMethod, TestCategory("UnitTest")]
public void TestMethod1()
{
}
[TestMethod, TestCategory("IntegrationTest")]
public void TestMethod2()
{
}
}
}
If, however, I move TestCategory to attribute on its own line, CodeRush does break out to 'UnitTest' and 'IntegrationTest' categories as expected.
Hi Jonathan,
Thank you for pointing out the issue and this code sample.
I have reproduced the issue with displaying the Empty category, but it seems that it does not relate to in-lining attributes and is caused by collecting tests from assemblies. To make sure that I have reproduced exactly the issue you experience, please disable collecting tests from assemblies and check whether the issue persists. For this, do the following:
Unchecking "Collect tests from assemblies when projects are built" does change the behavior for the better on initial solution load and still appears to be correct when I start adding a third test with its own category. However, as soon as I run the tests, they are placed back under 'Empty category'. If I then edit the test methods in any way, I see the test runner detect the category of the modified test and move it out from under 'Empty category'.
Thank you for the clarification.
> However, as soon as I run the tests, they are placed back under 'Empty category'.
This happens because tests are collected from assemblies as well. CodeRush Test Runner does that before running tests.
We are working on a fix for this case and will inform you of our progress.