a20afb5822
* add parameter list argument * add tests * fix test and add doc * correct test file * fix typo * fix tests * fix typo in file name * correct file name reverting the previous commit * correct property name * add checkmode message * changes as per review comments * variable casing and other review comment changes * define $test_parameters_check_mode_msg variable
119 lines
3.9 KiB
YAML
119 lines
3.9 KiB
YAML
---
|
|
- name: Run Pester test(s) specifying a fake test file
|
|
win_pester:
|
|
path: '{{test_win_pester_path}}\fakefile.ps1'
|
|
register: fake_file
|
|
failed_when: '"Cannot find file or directory: ''" + test_win_pester_path + "\\fakefile.ps1'' as it does not exist" not in fake_file.msg'
|
|
|
|
- name: Run Pester test(s) specifying a fake folder
|
|
win_pester:
|
|
path: '{{test_win_pester_path }}\fakedir'
|
|
register: fake_folder
|
|
failed_when: '"Cannot find file or directory: ''" + test_win_pester_path + "\\fakedir'' as it does not exist" not in fake_folder.msg'
|
|
|
|
- name: Run Pester test(s) specifying a test file and a higher pester version
|
|
win_pester:
|
|
path: '{{test_win_pester_path}}\test01.test.ps1'
|
|
minimum_version: '6.0.0'
|
|
register: invalid_version
|
|
failed_when: '"Pester version is not greater or equal to 6.0.0" not in invalid_version.msg'
|
|
|
|
- name: Run Pester test(s) specifying a test file
|
|
win_pester:
|
|
path: '{{test_win_pester_path}}\test01.test.ps1'
|
|
register: file_result
|
|
|
|
- name: assert Run Pester test(s) specify a test file
|
|
assert:
|
|
that:
|
|
- file_result.changed
|
|
- not file_result.failed
|
|
- file_result.output.TotalCount == 1
|
|
|
|
- name: Run Pester test(s) specifying a test file and with a minimum mandatory Pester version
|
|
win_pester:
|
|
path: '{{test_win_pester_path}}\test01.test.ps1'
|
|
minimum_version: 3.0.0
|
|
register: file_result_with_version
|
|
|
|
- name: assert Run Pester test(s) specifying a test file and a minimum mandatory Pester version
|
|
assert:
|
|
that:
|
|
- file_result_with_version.changed
|
|
- not file_result_with_version.failed
|
|
- file_result_with_version.output.TotalCount == 1
|
|
|
|
- name: Run Pester test(s) located in a folder. Folder path end with '\'
|
|
win_pester:
|
|
path: '{{test_win_pester_path}}\'
|
|
register: dir_with_ending_slash
|
|
|
|
- name: assert Run Pester test(s) located in a folder. Folder path end with '\'
|
|
assert:
|
|
that:
|
|
- dir_with_ending_slash.changed
|
|
- not dir_with_ending_slash.failed
|
|
- dir_with_ending_slash.output.TotalCount == 6
|
|
|
|
- name: Run Pester test(s) located in a folder. Folder path does not end with '\'
|
|
win_pester:
|
|
path: '{{test_win_pester_path}}'
|
|
register: dir_without_ending_slash
|
|
|
|
- name: assert Run Pester test(s) located in a folder. Folder does not end with '\'
|
|
assert:
|
|
that:
|
|
- dir_without_ending_slash.changed
|
|
- not dir_without_ending_slash.failed
|
|
- dir_without_ending_slash.output.TotalCount == 6
|
|
|
|
- name: Run Pester test(s) located in a folder and with a minimum mandatory Pester version
|
|
win_pester:
|
|
path: '{{test_win_pester_path}}'
|
|
minimum_version: 3.0.0
|
|
register: dir_with_version
|
|
|
|
- name: assert Run Pester test(s) located in a folder and with a minimum mandatory Pester version
|
|
assert:
|
|
that:
|
|
- dir_with_version.changed
|
|
- not dir_with_version.failed
|
|
- dir_with_version.output.TotalCount == 6
|
|
|
|
- name: Run Pester test(s) specifying a test file without specifying tag
|
|
win_pester:
|
|
path: '{{test_win_pester_path}}\test03.test.ps1'
|
|
register: test_no_tag
|
|
|
|
- name: assert Run Pester test(s) specifying a test file and all tests executed
|
|
assert:
|
|
that:
|
|
- test_no_tag.changed
|
|
- test_no_tag.output.TotalCount == 2
|
|
|
|
- name: Run Pester test(s) specifying a test file with tag
|
|
win_pester:
|
|
path: '{{test_win_pester_path}}\test03.test.ps1'
|
|
tags: tag1
|
|
register: test_with_tag
|
|
|
|
- name: Run Pester test(s) specifying a test file and only test with sepecified tag executed
|
|
assert:
|
|
that:
|
|
- test_with_tag.changed
|
|
- test_with_tag.output.TotalCount == 1
|
|
|
|
- name: Run Pester test(s) specifying a test file with parameters
|
|
win_pester:
|
|
path: '{{test_win_pester_path}}\test04.test.ps1'
|
|
test_parameters:
|
|
Process: lsass
|
|
Service: bits
|
|
register: test_with_parameter
|
|
|
|
- name: Run Pester test(s) specifying a test file with parameters
|
|
assert:
|
|
that:
|
|
- test_with_parameter.changed
|
|
- test_with_parameter.output.PassedCount == 2
|
|
- test_with_parameter.output.TotalCount == 2
|