dotnet / dotnet/docs

Need documentation and basic example of test discovery/execution API, if it exists

Open
#40,799 1 comment 0 reactions 1 assignee Claimed by @nohwnd View on GitHub
:watch: Not Triaged dotnet-fundamentals/svc
Dominant language
No language data
Stars
4.8k
Forks
6.1k
Avg merge
15h 21m
Merged PRs (30d)
370

Description

### Type of issue

Missing information

### Description

The MSTest runner documentation bills the MSTest runner as a replacement for VSTest, but the primary reason I use VSTest is for custom test discovery and execution for multi-environment integration tests. We wrap a custom internal web UI around VSTest to list, filter, execute tests (in a given internal or external environment) and generate custom reports.

So far, the documentation is unclear whether the test discovery side of the VSTest is supported, or if there is a strongly typed C# wrapper around the test execution side. From what I can see, only the test execution side is supported, and only through the CLI by executing the test output (an exe on windows) directly.

I don't see how to implement test discovery. There is the `--list-tests` option, but it only prints the test method names. It doesn't list test method test properties (including custom properties, which is important for my use case), and I'm not sure if there's an option to have it list them in json format vs a human readable list printed after some unrelated startup text (implying I'd need to write my own fragile parser).

On the test execution side, I know I can pass arguments directly to the test exe via a `Process.Start` call, but VSTest provided a C# wrapper around test execution. Does MSTest provide something similar? The documentation doesn't say, and it's difficult to determine looking from the code at a cursory glance. A lot of the test host classes are either internal or their constructors are. Is this something that is planned, but not yet implemented? Are custom test hosts not planned to be supported by design?

### Page URL

https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-mstest-runner-intro

### Content source URL

https://github.com/dotnet/docs/blob/main/docs/core/testing/unit-testing-mstest-runner-intro.md

### Document Version Independent Id

c6f1f63a-3871-51de-5385-59e72eff58e7

### Article author

@nohwnd

### Metadata

* ID: b75b7156-e2e2-b7d4-ead7-1fef711c3041
* Service: **dotnet-fundamentals**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.