From 6279dc1517b234aea7467799596e2dfe43017df8 Mon Sep 17 00:00:00 2001 From: Marc Jay Date: Thu, 7 May 2020 01:00:42 +0100 Subject: [PATCH] Show failures that are ignored due to whitelisting as skipped checks in JUnit output Continue to show (unwhitelisted) failed checks as failures in JUnit output, but rather than exclude failing whitelisted checks from JUnit, mark them as skipped Fixes #590 --- include/junit_integration | 4 ++++ include/outputs | 12 ++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/include/junit_integration b/include/junit_integration index c52ecb424c..090904dbad 100644 --- a/include/junit_integration +++ b/include/junit_integration @@ -76,6 +76,10 @@ output_junit_failure() { output_junit_test_case "$1" "" } +output_junit_skipped() { + output_junit_test_case "$1" "" +} + get_junit_classname() { #
. naturally follows a Java package structure, so it is suitable as a package name echo "$TITLE_ID" diff --git a/include/outputs b/include/outputs index c7e42e2ac1..37f230e5f2 100644 --- a/include/outputs +++ b/include/outputs @@ -106,13 +106,13 @@ textFail(){ FAIL_COUNTER=$((FAIL_COUNTER+1)) EXITCODE=3 fi - + if [[ $2 ]]; then REPREGION=$2 else REPREGION=$REGION fi - + if [[ "${MODES[@]}" =~ "csv" ]]; then echo "$PROFILE${SEP}$ACCOUNT_NUM${SEP}$REPREGION${SEP}$TITLE_ID${SEP}${level}${SEP}$ITEM_SCORED${SEP}$ITEM_LEVEL${SEP}$TITLE_TEXT${SEP}$1" | tee -a ${OUTPUT_FILE_NAME}.${EXTENSION_CSV} fi @@ -126,8 +126,12 @@ textFail(){ sendToSecurityHub "${JSON_ASFF_OUTPUT}" fi fi - if is_junit_output_enabled && [[ "$level" == "FAIL" ]]; then - output_junit_failure "$1" + if is_junit_output_enabled; then + if [[ "${level}" == "FAIL" ]]; then + output_junit_failure "$1" + elif [[ "${level}" == "WARNING" ]]; then + output_junit_skipped "$1" + fi fi if [[ "${MODES[@]}" =~ "mono" ]]; then echo " $colorcode ${level}! $1 $NORMAL" | tee -a ${OUTPUT_FILE_NAME}.$EXTENSION_TEXT