resharper-xunit icon indicating copy to clipboard operation
resharper-xunit copied to clipboard

Test runner doesn't show structure with nested test classes

Open havremunken opened this issue 10 years ago • 3 comments

Hi,

I'm trying to use a unit testing setup structure close to what Phil Haack described here:

http://haacked.com/archive/2012/01/02/structuring-unit-tests.aspx/

However, when I use nested classes for structuring tests, the ReSharper 9 test runner does not show the complete test structure. I do not know if this is an issue with the ReSharper test runner itself, or the xUnit specific extension.

Here is an exaggerated example to show my point:

image

When I run the unit tests with the option set to group by project structure, it looks like this:

image

If I try to group by Projects and Namespaces, it looks like this:

image

So it seems like we only see the actual class that contains a test - any parent classes that itself does not hold one or more unit tests are not visible as part of the hierarchy.

Is this by design, or should I actually be able to see the exaggerated structure in this case?

Edit: I should mention - one of the problems with this is that it gets hard to tell tests for different classes apart when doing this. In the example above, if I had another class with tests in a GivenNullInput subclass, they would be kept apart, but visible at the same level with no indication of what they belong to.

havremunken avatar Mar 13 '15 08:03 havremunken

Interestingly, this is how the nunit runner shows it. How would you expect it to look?

citizenmatt avatar Mar 16 '15 13:03 citizenmatt

That probably means that this request shouldn't be for the xUnit extension specifically.

In the last of my screenshots you can see the following structure:

TestStructureProject -TestStructureProject --GivenNullInput ---Does_Nothing

In order to get what I want (and keep in mind, this is unrealistic, just to underline the point), the structure would be something like

TestStructureProject -TestStructureProject --TestClassTests ---Methods ----SomeMethod -----GivenNullInput ------Does_Nothing

I doubt it would be that deep in practice, but I think it would be helpful to be able to display the full hierarchy of the test project, not just the root level, and then the classes that contain actual tests. In order to benefit from the Phil Haack method (link in first post), more of the structure would need to be visible.

havremunken avatar Mar 16 '15 14:03 havremunken

I agree that this would be very helpful.

ErikSchierboom avatar Oct 07 '15 14:10 ErikSchierboom