8000 [BUG] Test Explorer Fails for Generic Subclassed Tests · Issue #2016 · microsoft/vscode-dotnettools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[BUG] Test Explorer Fails for Generic Subclassed Tests #2016

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Werebunny opened this issue May 13, 2025 · 2 comments
Closed

[BUG] Test Explorer Fails for Generic Subclassed Tests #2016

Werebunny opened this issue May 13, 2025 · 2 comments
Labels
area-test Test discovery, execution, debugging bug Something isn't working

Comments

@Werebunny
Copy link

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

  1. 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.");
    }
}
  1. Create subclass:
public sealed class ProblemTests : InheritableTests<int> { }
  1. 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
@Werebunny Werebunny added the bug Something isn't working label May 13, 2025
@github-actions github-actions bot added the area-test Test discovery, execution, debugging label May 13, 2025
@ocallesp
Copy link
Member
ocallesp commented May 15, 2025

@Werebunny Based on the code snippet you provided, it looks like you're using xUnit v3. Could you confirm which version you're using?

version 2.0.2 some issues around 'Go to Test'

@ocallesp
Copy link
Member

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-test Test discovery, execution, debugging bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants
0