Skip to content

Pester3 Task

Aaron Jensen edited this page Feb 24, 2020 · 2 revisions

Overview

The Pester3 tasks runs Pester tests using Pester 3. You pass the path(s) to test to the Path parameter, which are passed directly to the Invoke-Pester function's Script parameter.

By default, the latest verson of Pester 3 is used. To pin to a specific version, set the Version property to the version you want to use. Wildcards are supported. Pester is installed into a PSModules directory in your build root.

If any tests fail (i.e. if the FailedCount property on the result object returned by Invoke-Pester is greater than 0), the build will fail.

Test reports are saved to the output directory in NUnit XML format. The report files are named pester+RANDOM_STRING.xml, where RANDOM_STRING is a random strings of characters.

When running under AppVeyor, test results are also automatically posted to your build's test results.

Properties

  • Path (mandatory): paths to pass to the Invoke-Pester command's Script parameter. Paths must exist and must be under the build root.
  • Version: the version of Pester 3 to use. Defaults to the latest version of Pester 3. Wildcards supported. Use wildcards to pin to a specific minor version, e.g. 3.1.* would use the lastest version of the 3.1 release, but never use 3.2 or later.

Examples

Example 1

Build:
- Pester3:
    Path: Test\*.Tests.ps1

Demonstrates the simplest way to use the Pester3 task. In this case, all files that match the Test\*.Tests.ps1 wildcard will be run.

Example 2

Build:
- Pester3:
    Version: 3.4.6
    Path: Test\*.Tests.ps1

Demonstrates how to pin to a specific version of Pester 3. In this case, version 3.4.6.

Example 3

Build:
- Pester3:
    Version: 3.4.*
    Path: Test\*.Tests.ps1

Demonstrates how to pin to a specific MAJOR.MINOR version of Pester 3. In this case, the lastest 3.4 version would be used.

Clone this wiki locally