-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Migrate from vstest
to Microsoft.Testing.Platform
#41
Comments
For XUnit v3 specifically it looks like this is the only way to have custom reporters. It is likely that this library would have to be packaged for each test runner to support |
Removing the I haven't been following the development of the new testing platform, what state is it in? I'm not at all keen on maintaining/distributing a separate logger for each framework. |
I tried looking through the links you sent, as well as Googling around, and I still have no idea how a custom logger would look like with Microsoft.Testing.Platform. It seems that all of xUnit's related switches are for its own built-in loggers. |
Microsoft.Testing.Platform
is not supported
Hi @Tyrrrz, Keep in mind that As for the logging itself, it depends what you want to do. VSTest is mixing many concepts under logger (which is also conflicting with diagnostic) which is one of the things we broke/split into MTP where we now have loggers (designed for diagnostic) and reporters (designed for informative messages/reports). TRX is a reporter, the live terminal is a reporter... For the diagnostic logging, we have separate arguments, see https://learn.microsoft.com/dotnet/core/testing/unit-testing-platform-intro?tabs=dotnetcli#options EDIT It seems that what you are looking for is to build a custom reporter. Please refer to this code sample: https://github.com/microsoft/testfx/tree/main/samples/public/mstest-runner/CustomReportExtension/CustomReportExtension and to this tech doc https://learn.microsoft.com/dotnet/core/testing/unit-testing-platform-architecture EDIT 2 |
@Evangelink thank you for the info. Yes, I guess what I'm after is a custom reporter, according to the new terminology. Is there a list of all possible update messages and their properties? Also, are there any downsides to providing the reporter/logger in the same package for both vstest/MTP? VStest would resolve the logger via conventions/reflection and for MTP the user would call an extension method on the builder instead. I really hate creating separate packages for each separate integration. |
Thanks @Evangelink. I think I just need the equivalents of these events: GitHubActionsTestLogger/GitHubActionsTestLogger/TestLogger.cs Lines 17 to 19 in 4c26c3c
So probably Also, what is the recommended approach to handing options for reporters with MTP? Since they're registered through code, I can imagine that passing options directly in the method call would work. However, I think some options are better off passed through command line since there will be different things that the user would want to configure on their CI environment. Currently, the options are consumed through the What's the idiomatic equivalent for doing the same with MTP? Just read |
You want to register a command line extension, example: https://github.com/microsoft/testfx/blob/main/src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxCommandLine.cs |
@Evangelink I see. Looks like supporting MTP will be quite a fork, seeing as only about 20% of the code can be effectively shared. A lot of the documentation will also be different too. I'd rather not maintain support for both MTP and vstest. Is the intent to deprecate vstest in the future? In which case, when is that future expected so I can migrate the logger/reporter entirely instead of supporting two paradigms? |
Mine yes :) But quite frankly it will take a long time to be able to move away everyone (including big corps). I'd be happy to provide the GH support directly under our repo as this seems like something we should be providing but I don't want to sound like I am stealing your idea/project. Happy to brainstorm with you what would be the best for you. |
In a perfect scenario, I think I would migrate to using MTP exclusively and direct vstest users to older (now unmaintained) versions of the package. For this, I guess MTP would have to be stable enough and supported by all major testing frameworks. Supporting both vstest and MTP at the same time would effectively mean maintaining two completely separate instances of the package. I'm not entirely against the idea, but that doesn't sound very exciting. My reasoning for why there is not much of an overlap in the code between the two, is because most of the heavy lifting done by the library is interacting with vstest's events and extracting data from them. I'll think on this for a bit and see what makes the most sense. In any case, supporting MTP seems like it would be a necessity given that the eventual goal is to make it the default option. |
I was actually coming back to write that you could consider stopping support of VSTest given it's pretty stable and for sure nothing big will change there. As for the support and stability of MTP. It's been released in v1 in Jan 2024 and we are currently in v1.6. For the support across various test frameworks, I have released a blogpost announcing the support for the major test frameworks https://devblogs.microsoft.com/dotnet/mtp-adoption-frameworks/ |
Okay, in that case that looks like the best path forward :) I added this issue to my personal tracker, but can't promise when I'll be able to work on it. If someone wants to tackle this via PR, you're very welcome to. |
Microsoft.Testing.Platform
is not supportedvstest
to Microsoft.Testing.Platform
Version
2.4.1
Platform
ubuntu-latest GH runner
Steps to reproduce
Microsoft.Testing.Platform
dotnet test --logger GitHubActions -- --report-xunit-trx
Details
With the new
Microsoft.Testing.Platform
the--logger
parameter is no longer parsed bydotnet test
at all. Unfortunately there does not seem to be a migration path. The logging should be handled by the test framework according to the docs. Am I missing something here? Or is there a way to still use this logger with the new test platform? For xunit specifically, these are the parameters it supports via the new framework.Checklist
The text was updated successfully, but these errors were encountered: