Skip to content

junit

Collection Note

This module is part of the ansible.builtin collection. To install the collection, use:

ansible-galaxy collection install ansible.builtin
Added in version historical.

You need further requirements to be able to use this module, see the Requirements section for details.

Synopsis

  • This callback writes playbook output to a JUnit formatted XML file.
  • Tasks show up in the report as follows: 'ok': pass 'failed' with 'EXPECTED FAILURE' in the task name: pass 'failed' with 'TOGGLE RESULT' in the task name: pass 'ok' with 'TOGGLE RESULT' in the task name: failure 'failed' due to an exception: error 'failed' for other reasons: failure 'skipped': skipped

Requirements

The following Python packages are needed on the host that executes this module:

Parameters

Parameter Defaults / Choices Comments
fail_on_change Consider any tasks reporting "changed" as a junit test failure
Env: JUNIT_FAIL_ON_CHANGE
fail_on_ignore Consider failed tasks as a junit test failure even if ignore_on_error is set
Env: JUNIT_FAIL_ON_IGNORE
hide_task_arguments Hide the arguments for a task
Env: JUNIT_HIDE_TASK_ARGUMENTS
Version Added: 2.8
include_setup_tasks_in_report Default: True
Should the setup tasks be included in the final report
Env: JUNIT_INCLUDE_SETUP_TASKS_IN_REPORT
output_dir Default: ~/.ansible.log
Directory to write XML files to.
Env: JUNIT_OUTPUT_DIR
replace_out_of_tree_path Default: none
Replace the directory portion of an out-of-tree relative task path with the given placeholder
Env: JUNIT_REPLACE_OUT_OF_TREE_PATH
Version Added: 2.12.3
task_class Configure the output to be one class per yaml file
Env: JUNIT_TASK_CLASS
task_relative_path Default: none
Configure the output to use relative paths to given directory
Env: JUNIT_TASK_RELATIVE_PATH
Version Added: 2.8
test_case_prefix Default:
Consider a task only as test case if it has this value as prefix. Additionally failing tasks are recorded as failed test cases.
Env: JUNIT_TEST_CASE_PREFIX
Version Added: 2.8