Search code examples
powershellappveyorpester

How do i redirect output to the Pester xml file?


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.


Solution

  • 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.