0
votes

As noted here: https://docs.microsoft.com/en-us/azure/devops/pipelines/test/review-continuous-test-results-after-build?view=azure-devops#tests-tab

If you use the Visual Studio Test task to run tests, diagnostic output logged from tests (using any of Console.WriteLine, Trace.WriteLine or TestContext.WriteLine methods), will appear as an attachment for a failed test.

How can I enforce Azure Devops pipelines to publish attachments for successful tests?

Update

riQQ pointed to the another stackoverflow question:Azure DevOps: Console output for green tests is missing Proposed solution doesn't help me, because they solved using TestContext. We are using xUnit, and there is no TestContext for xUnit.

1
It doesn't solve my problem. We are using xUnit, and there is TestContext for this.Alexander S.
See my answer here: stackoverflow.com/a/59686387/3241243. Alternatively, you can use the REST API to upload attachments: docs.microsoft.com/en-us/rest/api/azure/devops/test/…riQQ
Thank you. Little bit complicated, and no time for now for ensure it works. I'll try to check this later.Alexander S.
Hi friend, just checking in to see whether the issue persists to block you. Any update feel free to let us know :)LoLance

1 Answers

1
votes

How can I enforce Azure Devops pipelines to publish attachments for successful tests?

Sorry but as I know this is not supported behavior for VSTest Task. It's by design that only failed tests should have the log as attachment. And after my check, no extensions in Marketplace extends this kind of option.

So if you do want this option, you may consider using rest api like what riQQ suggests above. Or you can post a new feature request in DC forum, it it gets enough votes, the team would consider it seriously.

Hope it helps :)