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

dotnet test Microsoft.Testing.Platform experience #45927

Open
Evangelink opened this issue Jan 13, 2025 · 7 comments
Open

dotnet test Microsoft.Testing.Platform experience #45927

Evangelink opened this issue Jan 13, 2025 · 7 comments
Assignees
Labels
Announcement Area-DotNet Test Epic Groups multiple user stories. Can be grouped under a theme.
Milestone

Comments

@Evangelink
Copy link
Member

Evangelink commented Jan 13, 2025

Summary

Introduce a new dotnet test experience that is focused toward the new testing platform Microsoft.Testing.Platform (aka MTP).

This ticket will act as the hub of all implementations related to the new dotnet test experience.

Background and Motivation

We have introduced a new testing platform as an alternative to VSTest, this new testing platform, named Microsoft.Testing.Platform changes fundamentally the way the test applications are structured.

VSTest:

Image

Microsoft.Testing.Platform:

Image

Currently, Microsoft.Testing.Platform allows tests to be run through dotnet test using some workaround by injecting a named target that will be loaded by dotnet test code in place of the one from VSTest. This behavior is fine when doing basic dotnet test call but is showing problem when we want to use more advanced features as the options are statically declared and tuned for VSTest. For example, we need to do dotnet test -- --minimum-expected-tests 10 or dotnet test -p:TestingPlatformCommandLineArguments="--minimum-expected-tests 10". This is also causing confusions to users for some arguments, for example, doing dotnet test --filter A will not forward the filter down to the new platform but will eat the argument for VSTest (which is not plugged in that context) and users should instead do dotnet test -- --filter A or dotnet test -p:TestingPlatformCommandLineArguments="--filter A".

One downside to the new testing platform is that each test application is working in "isolation" to other test applications while some features are expected to be provided as cross-test apps (e.g. users would expect at least one merge trx report and not only 1 trx per test application).

Proposed Feature

Instead of shipping an extra client executable, we will use dotnet process to act as a client and offer pre and post run capabilities.

The new testing platform offers the possibility to extend the supported command line arguments so we no longer can simply rely on a static way but instead either ask test applications for their supported options (e.g. when user will do dotnet test --help) or forward the extra parameters down to the test applications (e.g. dotnet test --coverage, the --coverage needs to be forward to each test application).

We should allow users to select the dotnet test mode (see #45471) to be either the new experience or the old one.

Under discussions

  • We are currently discussing what to do for the case of "mixed mode", at least one project using VSTest and one project using MTP.

Limitations

Other

Note that I will edit this main design as we progress through the design and implementation and incorporate user's comments.

Pinging main test framework authors:

@Evangelink Evangelink added Announcement Area-DotNet Test breaking-change Using this label will notify dotnet/compat and trigger a request to file a compat bug labels Jan 13, 2025
@Evangelink Evangelink added this to the 10.0.1xx milestone Jan 13, 2025
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged Request triage from a team member label Jan 13, 2025
Copy link
Contributor

Added needs-breaking-change-doc-created label because this issue has the breaking-change label.

  1. Create and link to this issue a matching issue in the dotnet/docs repo using the breaking change documentation template, then remove this needs-breaking-change-doc-created label.

Tagging @dotnet/compat for awareness of the breaking change.

@Evangelink Evangelink removed the untriaged Request triage from a team member label Jan 13, 2025
@baronfel baronfel added Epic Groups multiple user stories. Can be grouped under a theme. and removed breaking-change Using this label will notify dotnet/compat and trigger a request to file a compat bug needs-breaking-change-doc-created labels Jan 13, 2025
@bradwilson
Copy link
Contributor

Perhaps a nitpick, but your MTP diagram shows loading xunit.runner.visualstudio, but that is only ever used for VSTest. Our MTP support is baked into the test executable by default automatically.

@Evangelink
Copy link
Member Author

Thanks @bradwilson! I have indeed reused old diagram before you actually did the implementation. I'll update/fix that.

@thomhurst
Copy link

thomhurst commented Jan 13, 2025

How does this work with older SDKs? Do they get a new patch/minor version? Or will this only be in new .NET 9/10 ones?

@MarcoRossignoli
Copy link
Member

Thanks @bradwilson! I have indeed reused old diagram before you actually did the implementation. I'll update/fix that.

If I recall is loading xunit.core right @bradwilson?

@bradwilson
Copy link
Contributor

If I recall is loading xunit.core right @bradwilson?

If you mean which assembly/package does the M.T.P. code live in, it's xunit.v3.runner.inproc.console (which is responsible for the command line dotnet run experience for v3): https://github.com/xunit/xunit/tree/main/src/xunit.v3.runner.inproc.console/TestingPlatform

@Evangelink
Copy link
Member Author

How does this work with older SDKs? Do they get a new patch/minor version? Or will this only be in new .NET 9/10 ones?

It would be available only for NET 10+. We could discuss backporting to NET 9 but I think we would need to have a really strong justification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Announcement Area-DotNet Test Epic Groups multiple user stories. Can be grouped under a theme.
Projects
None yet
Development

No branches or pull requests

6 participants