xUnit, ReSharper and Nested Classes Follow
Hello,
Why ReSharper does not display parent classes in the "Unit Test Explorer" and "Unit Test Sessions" windows ?
Here is an example.
namespace EasyFront.Dependencies
{
using System;
using Xunit;
public class DependencyRegistrarTest
{
private static DependencyRegistrar CreateDependencyRegistrar()
{
return new DependencyRegistrar();
}
public class IsRegistered
{
[Fact]
public void Should_return_false_when_the_contract_does_not_exist()
{
// Arrange
DependencyRegistrar registrar = CreateDependencyRegistrar();
Type contract = typeof(object);
// Act
bool registered = registrar.IsRegistered(contract);
// Assert
Assert.False(registered);
}
[Fact]
public void Should_return_true_when_the_contract_exists()
{
// Arrange
DependencyRegistrar registrar = CreateDependencyRegistrar();
Type contract = typeof(object);
// Act
bool registered = registrar.IsRegistered(contract);
// Assert
Assert.True(registered);
}
}
}
}
Here is how it looks like.
Please sign in to leave a comment.
Hello Eyal
Have you tried playin with the grouping in the 'Group by' drop-down list in these windows? Thank you!
Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
Yeah, I did and unfortunately it doesn't help.
Seems not to be related to xUnit nor nested classes, but rather the fact the base class does not contain any tests.
Consider NUnit structure below:
Reflections:
1) Foo does indeed show up in unit test explorer, however not in unit test sessions. And you can NOT select Foo in explorer to run all tests derived from it so it doesn't really help displaying it.
2) If having 1 test in Foo, it will show in both explorer and session window, but adding Foo will, as case 1, not add derived tests.
3) If having Foo abstract, it will not show up in either explorer nor unit test sessions.
I.e. in current RS behavior there is no easy way I can test all "Foo" tests, I must select 1 derived tests and e.g. select all tests in that namespace.
HTH
Yeah, I agree, it should really display the tests using the real structure of the tests although in my scenario base classes do not exist but I guess the reason that these classes aren't displayed is just like you said, no tests.
This is a major problem in my scenario because each class describe a method, I hope that JetBrains will fix it asap.
Is there anything being done ? because right now I have to see a hundreds of classes in the same namespaces ... please do something about it!
Hello Eyal
You're welcome to vote for the following requests:
http://youtrack.jetbrains.com/issue/RSRP-199079
http://youtrack.jetbrains.com/issue/RSRP-266247
Thank you!
Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"