vscode-dotnet-test-explorer
vscode-dotnet-test-explorer copied to clipboard
Test Explorer Issues on Inheritance
When you have something like this:
public abstract class TestTemplate { [Fact] public Task Some_Test() { ... } }
public class SomeTest : TestTemplate { ... }
Test Explorer can properly see that SomeTest contains a test called Some_Test. However, clicking on the test would show a warning "Could not find test".
Closing this issue as putting the test on the base class makes it really hard to execute the "Debug Test" on vscode.
I would actually appreciate a fix for this issue. Seems to be that OmniSharp doesn't have inherited members in the symbol list that it searches when provideWorkspaceSymbols() is called. I'm not sure if the solution is to have the dotnet test explorer provide a different string or if OmniSharp doesn't behave as expected.
I think this should remain open - I use inherited classes in a lot of cases, especially when using inheritance in the code I am testing. This allows me to write tests that are applicable to all implementing classes a single time. Running the tests in the Test Explorer will run the tests in the base class and they show in the correct place, but I cannot run them by just clicking on them. This is extra annoying because I also can't use CodeLens to run them, so the only way to do so is to use dotnet test
cli or to run tests in class in the Test Explorer, which only works like 1/4 the time.
Hmm yea if I remember correctly it was Omnisharp that was unable to find the location of the symbol and since that is what we use to find the place to go to when clicking it was hard for us to solve it.
But maybe never versions of Omnisharp supports this better.
I would love this to be fixed as well. I use a lot of inherited classes.
Seems like omnisharp has changed since then.
The following two tests are now shown correctly under Concrete
in the test explorer, and can be run successfully:
public abstract class Base {
[Fact] public void test1() { }
[Fact] public void test2() { }
}
public class Concrete : Base {
}
Obviously there are two limitations, which cannot be fixed:
- debugging cannot be performed
- one cannot use codelens to start tests
And there is one remaining bug:
-
Concrete
will not run tests fromBase
in codelens (codelens is not even shown); but they can be run from the test explorer
Hello, is there any update ?