Some time ago I have moved one of my PowerShell projects to a new Atlassian Bitbucket server with Bamboo connection for Continuous Integration and Continuous Deployment. To continue using my existing code validation scripts I was looking for a Bamboo PowerShell Pester Integration. For the interoperability both tools, Pester and Bamboo, can handle Test-Results in NUnit XML format.
My example plan is configured with default Bamboo settings and some additional variables which are used for the detailed integration tests of the project (not covered by this blog post).
Stage Jobs
A Bamboo plan has beside the basic configuration one or more stages. The stages within
a plan can have one or more jobs. Bamboo executes the plans of a stage in parallel.
On the other hand, jobs can have one or more tasks, which are executed one after the other. A task is a piece of work that is being executed as part of the build.
Source Code Checkout
The source code checkout is a default task. This step is required so that the agent can execute the following tasks.
Import Module PowerShell task
This task imports the Pester PowerShell Module into the PowerShell Session of the Bamboo Agent. In most cases, this is not necessary because of PowerShell autoload.
|
|
Pester PowerShell task
That’s the most important task, it runs the Pester tests. The results are returned as NUnitXml.
|
|
NUnit Parser configuration
This task parses the Pester test results from the previous tasks NUnitXml result file.
Job Results
Thanks to the tight Bamboo PowerShell Pester integration all test results are well presented in the web interface.
If one of the tests throws an error, the details are collected from the task and are also presented in the web interface.