win_pester – Run Pester tests on Windows hosts¶
New in version 2.6.
Parameters¶
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
- name: Run the pester tests only for the tags specified.
  win_pester:
    path: C:\Pester\TestScript.tests
    tags: CI,UnitTests
# 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
- name: Run the pester test present in a folder with given script parameters.
  win_pester:
    path: C:\Pester\test04.test.ps1
    test_parameters:
      Process: lsass
      Service: bits
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 not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Community. [community]
Authors¶
- Erwan Quelin (@equelin)
Hint
If you notice any issues in this documentation, you can edit this document to improve it.
