1

I would like to know how to add additional output to the Pester test XML file using PowerShell commands such as Out-Host or Write-Debug.

I wish to do this so that I can observe the output on the appveyor tests page. example appveyor tests page

As you can see in the above image the pester tests do not have an Std OUT option.

In searching for an answer I stumbled upon this github issue which described the exact thing I want to do but doesn't provide a solution.

The only workaround I have been able to get to work is to force the pester test to write to the console using Out-Host so that I can cross reference the output with the test.

Jfm Meyers
  • 123
  • 1
  • 12
  • I wonder if you could run [Add-AppveyorTest](https://www.appveyor.com/docs/build-worker-api/#add-tests) as [AfterEach](https://github.com/pester/Pester/wiki/BeforeEach-and-AfterEach) command instead of uploading XML results. But I cannot find how to access current test data from `AfterEach` command. – Ilya Finkelsheyn Aug 07 '17 at 18:07

1 Answers1

1

I think per the issue you linked to, this is currently not possible and will only become possible when the developers of Pester build it in as functionality. I suggest raising a new issue for it on GitHub as the one you referenced was quite old. It seems like a pretty valid request.

It's worth noting also that Pester already captures the error output of failed tests into the nunit xml output.

Mark Wragg
  • 22,105
  • 7
  • 39
  • 68
  • if I can learn enough about how Pester works I might see if I can expose a verb like "Write-MessageField" which will allow for piping content to the nunit xml message field. – Jfm Meyers Aug 18 '17 at 02:32