win_pester - Run Pester tests on Windows hosts

New in version 2.6.

Synopsis

  • Run Pester tests on Windows hosts.
  • Test files have to be available on the remote host.

Requirements

The below requirements are needed on the host that executes this module.

  • Pester

Parameters

Parameter Choices/Defaults Comments
path
required
Path to a pester test file or a folder where tests can be found.
If the path is a folder, the module will consider all ps1 files as Pester tests.
version
Minimum version of the pester module that has to be available on the remote host.

Examples

- name: Get facts
  setup:

- name: Add Pester module
  action:
    module_name: "{{ 'win_psmodule' if ansible_powershell_version >= 5 else 'win_chocolatey' }}"
    name: Pester
    state: present

- name: Run the pester test provided in the path parameter.
  win_pester:
    path: C:\Pester

# Run pesters tests files that are present in the specified folder
# ensure that the pester module version available is greater or equal to the version parameter.
- name: Run the pester test present in a folder and check the Pester module version.
  win_pester:
    path: C:\Pester\test01.test.ps1
    version: 4.1.0

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
output
list
success
Results of the Pester tests.

pester_version
string
always
Version of the pester module found on the remote host.

Sample:
4.3.1


Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Maintenance

This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.

For a list of other modules that are also maintained by the Ansible Community, see here.

Author

  • Erwan Quelin (@erwanquelin)

Hint

If you notice any issues in this documentation you can edit this document to improve it.

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.6/modules/win_pester_module.html