2018-04-17 07:24:54 +02:00
|
|
|
---
|
|
|
|
- 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
|
2019-07-22 21:46:26 +02:00
|
|
|
- dir_with_ending_slash.output.TotalCount == 6
|
2018-04-17 07:24:54 +02:00
|
|
|
|
2019-07-04 23:45:52 +02:00
|
|
|
- name: Run Pester test(s) located in a folder. Folder path does not end with '\'
|
2018-04-17 07:24:54 +02:00
|
|
|
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
|
2019-07-22 21:46:26 +02:00
|
|
|
- dir_without_ending_slash.output.TotalCount == 6
|
2018-04-17 07:24:54 +02:00
|
|
|
|
|
|
|
- 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
|
2019-07-22 21:46:26 +02:00
|
|
|
- dir_with_version.output.TotalCount == 6
|
2019-07-04 23:45:52 +02:00
|
|
|
|
|
|
|
- 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
|
2019-07-22 21:46:26 +02:00
|
|
|
|
|
|
|
- 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
|
2019-11-12 07:13:52 +01:00
|
|
|
|
|
|
|
- name: Run Pester test(s) specifying a test file by generating test result xml
|
|
|
|
win_pester:
|
|
|
|
path: '{{test_win_pester_path}}\test03.test.ps1'
|
|
|
|
output_file: '{{test_report_file}}'
|
|
|
|
|
|
|
|
- name: Checks if the output result file exists
|
|
|
|
win_stat:
|
|
|
|
path: '{{test_report_file}}'
|
|
|
|
register: test_output_file
|
|
|
|
|
|
|
|
- name: Checks if the output result file exists
|
|
|
|
assert:
|
|
|
|
that:
|
|
|
|
- test_output_file.stat.exists
|