[BUG] Test Explorer Fails for Generic Subclassed Tests · Issue #2016 · microsoft/vscode-dotnettools · GitHub
More Web Proxy on the site http://driver.im/
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When inheriting tests from a base class, if the base class utilizes generics, the Test Explorer will no longer show what actual errors are occurring when tests fail nor have the option to go to test.
Steps To Reproduce
Create base class (these examples are using xUnit):
public abstract class InheritableTests<T> where T : struct
{
[Fact]
public void PassingTest()
{
"Cannot goto test".Assert().IsNotEmpty();
}
[Fact]
public void FailingTest()
{
throw new InvalidOperationException("Error does not show in explorer.");
}
}
Create subclass:
public sealed class ProblemTests : InheritableTests<int> { }
Run the tests. Note the tests show up in the test explorer view, but selecting the failing test does not show the error, and neither test have the option to Go to Test.
Expected Behavior
Selecting these tests should behave as any other test, that is, selecting these tests should go to the test and the failing test should pop up the failure.
Environment Information
OS: macOS
VS Code Version: 1.100.1
Extension Version: 1.19.63
The text was updated successfully, but these errors were encountered:
@Werebunny
Since this is more related to metadata from tests, it seems the issue may be with the xUnit test adapters not correctly handling subclass scenarios. If the latest version of xUnit v3 doesn't address this, we might need to report it upstream.
Longer-term, we are planning to integrate Roslyn to retrieve test metadata directly, rather than relying on the adapters. This should resolve issues like this moving forward.
Describe the Issue
When inheriting tests from a base class, if the base class utilizes generics, the Test Explorer will no longer show what actual errors are occurring when tests fail nor have the option to go to test.
Steps To Reproduce
Expected Behavior
Selecting these tests should behave as any other test, that is, selecting these tests should go to the test and the failing test should pop up the failure.
Environment Information
The text was updated successfully, but these errors were encountered: