-
Notifications
You must be signed in to change notification settings - Fork 377
Provide an injection point for custom test reporting functionality #15775
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,6 +79,16 @@ | |
<_ResultsFileToDisplay Condition="!Exists('$(_ResultsFileToDisplay)')">%(TestToRun.ResultsStdOutPath)</_ResultsFileToDisplay> | ||
</PropertyGroup> | ||
|
||
<!-- | ||
Allow running an arbitrary target after the tests have been executed. This is useful for running custom test reporting tools. | ||
--> | ||
<MSBuild Projects="$(OnTestsExecutedProject)" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At least for xunit.v3 where we expect most repos to use MTP, I have same comment as in the Aspire PR. Whatever logic that will be done, why can't it be served via MTP extensibility? If the whole issue is that Arcade redirects stdout to a log file, it's already possible to disable that with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Are there any samples to show how this can be achieved with the MTPE?
No, this is not the purpose of this change. I want to be able to execute an arbitrary target (in the case of Aspire - report successful and failed tests) between the finish of the tests execution and the reported error. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And you are sure want that even though it will only work with Arcade's Test target but not with dotnet test or inside VS with Test Explorer? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes |
||
Properties="$(OnTestsExecutedProperties);Project=$(MSBuildProjectName);LogFile=%(TestToRun.ResultsStdOutPath);TrxFile=%(TestToRun.ResultsTrxPath);ExitCode=$(_TestErrorCode);TestEnvironment=$(_TestEnvironment);TestAssembly=$(_TestAssembly);TargetFramework=%(TestToRun.TargetFramework)" | ||
Targets="OnTestsExecuted" | ||
SkipNonexistentProjects="true" | ||
Condition=" Exists('$(OnTestsExecutedProject)') " | ||
/> | ||
|
||
<!-- | ||
Ideally we would set ContinueOnError="ErrorAndContinue" so that when a test fails in multi-targeted test project | ||
we'll still run tests for all target frameworks. ErrorAndContinue doesn't work well on Linux though: https://github.com/Microsoft/msbuild/issues/3961. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume you need this push mechanism here because the Error statement below ends all execution and so you can't sequence a target after it?
If that's the case, I would rather put the Error task into a separate target that runs after this one so that we can sequence additional targets between them, i.e.:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That allows for more extensibility in general and avoids the use of the MSBuild task here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the idea, though it would be a more invasive change. Are we comfortable with it?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I'm fine with changing targets here. If we keep the RunTests target which depends on the both other targets then there shouldn't be any potential fallout.
Example: RunTests -> ExecuteTests, ReportTestResults