Skip to content

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

@egil

Description

@egil

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions