Pester Operational Testing results to Slack take2

So I have been doing some work in the infrastructure as code space and I have been utilizing Operational testing with Pester to make sure that the environment is configured and working as intended.

I used Irwin´s work in Active Directory tests and adding several other parts for SQL etc so it would do the tests that was applicable for us! Then I scheduled it to run every day at 9 AM and reportunit created nice html reports like Irwins that was sent to operations email box as an attachment.

Now I got a new request from one of the recipients that they wanted it in a Slack channel instead so I used the Warrens Slack module like Irwin.

screen-shot-2016-11-02-at-15-20-51

So far so good! Though when I had an failed test we did not get any more information in the slack message and we would need to go to the mail and open the Nunit html report to find out what pester tests actually was failing and that is lame right?!

How could I add that information in the slack message so we got to know what tests failed from the same place? Here I had to add a some code to Irwins to make it also display some meaningful information, which in the extension could be utilized by a chatops bot 🙂

screen-shot-2016-11-02-at-15-20-30

As you can see only if I will get more than 0 failed tests I create an array of the errors and then send them as one message

Happy Operations Testing!