Skip to content
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

Enable the "navigate to test" feature in VS Test Explorer for razor-based tests #106

Closed
egil opened this issue Apr 28, 2020 · 1 comment · Fixed by #103
Closed

Enable the "navigate to test" feature in VS Test Explorer for razor-based tests #106

egil opened this issue Apr 28, 2020 · 1 comment · Fixed by #103
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@egil
Copy link
Member

egil commented Apr 28, 2020

A part of the custom xUnit RazorTestDiscoverer that is currently missing is the ability to lookup the test in a .razor file, by double clicking on the test in the VS Test Explorer (and perhaps also in VS Code and others.

To do so, all RazorTestCases must be provided with a ISourceInformation, which contains a file path to the .razor file and a line number.

It should be possible to use the System.Reflection.Metadata package to get the filename of the generated test component's .cs file, based on the type and assembly the razor test available in the test discoverer, and then from the .cs file find the .razor file and figure out the line number.

Initial attempts with the metadata API hasn't been successful though: https://github.com/egil/FindSourceFilePath

This depends on #103 PR being merged.

@egil egil added enhancement New feature or request help wanted Extra attention is needed labels Apr 28, 2020
@egil egil added this to the beta-7 milestone Apr 29, 2020
@egil egil linked a pull request Apr 30, 2020 that will close this issue
@egil
Copy link
Member Author

egil commented Apr 30, 2020

The naive implementation of line finder is done. Hope for a more stable solution in the future via https://github.com/dotnet/aspnetcore/issues/21368.

@egil egil closed this as completed Apr 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant