Sadly, with the demise of the PowerShell + DevOps Global Summit in 2020, there will be no Iron Scripter Game. However, that doesn’t mean you shouldn’t continue to hone your skills. The Chairman has been pestered the last several weeks for a new challenge. So be careful what you ask for.
As with all of the challenges posted on this site, these are individual challenges intended to test your PowerShell skills and encourage you to learn new things. That said, you might find it helpful or fun to work on these challenges in a group. As always, use the comments to share links to your work or solutions. Do not post your answers directly.
This challenge is probably somewhere between Intermediate and Advanced in difficulty. It assumes you have some familiarity with Pester and the Invoke-Pester command.

One of the reasons for using Pester is to incorporate it into build pipelines and automation workflows. One Pester feature that you can use is the Invoke-Pester option to save test results to an XML file. This challenge assumes you have done just that. You have an XML results file.
The Chairman’s challenge is for you to write a PowerShell script or function that can consume the XML file and re-create the same Pester output. You aren’t running the tests. You are displaying the formatted results.
Minimum Requirements
Your solution at a minimum should be able to do the following:
- Take the path to the XML file as a parameter
- Recreate the Describe blocks
- Display results to the screen in the correct color. Using Write-Host is perfectly fine for this exercise.
- You should properly display passed, failed, skipped and pending tests.
- Include the summary line
The XML file can be one of two possible “flavors”. You can limit your solution to a single format. Although you should have error handling and/or testing for the format.
Advanced Requirements
If you want to go above and beyond see how many of these items you can incorporate into your function.
- Pass the XML file via the pipeline
- Accomodate both XML formats
- Accommodate Context
- Format times as timespans. This will be more useful for tests that took more than a few seconds to run.
- Include a header that shows:
- the path to the original pester test file
- the computer name where the test was run
- the user who ran the test
- When the test was run
- If you are running PowerShell 7, consider using ANSI escape sequences to display the results.
- Create a second command that will write the same results as text so that it can be sent to a file or printer.
There is no deadline for this or any of the Chairman’s challenges. When you knock this one out, try your hand at other challenges on the site. Good luck.
Nice challenge! Really enjoyed working on it 🙂
My solution is on https://github.com/nahir31/Get-PesterReplay/blob/master/Get-PesterReplay.ps1
Here’s my solution. https://jdhitsolutions.com/blog/powershell/7409/importing-pester-results-into-powershell/