Feature: write summary with negative cases
[platform/upstream/SSAT.git] / ssat-api.sh
index 4f4ecee..2b11b08 100644 (file)
@@ -84,7 +84,7 @@ function report() {
                        writef "${Red}[FAILED]${NC} Test Group $_group has ${Red}failed cases ($_fail)${NC}"
                else
                        writef "${Green}==================================================${NC}"
-                       writef "${LightGreen}[PASSED]${NC} Test Group $_group has ${Red}failed cases ($_fail), but they are not critical.${NC}"
+                       writef "${LightGreen}[PASSED]${NC} Test Group $_group has ${Red}failed cases ($_fail), but they are ignorable cases and not critical.${NC}"
                fi
        fi
 
@@ -93,7 +93,14 @@ function report() {
        # do nothing
                echo ""
        else
-               writef "${_cases},${_pass},${_fail}"
+               _ignore=$((_fail-_criticalFail))
+               _fail=${_criticalFail}
+               if [[ "${COUNTNEGATIVE}" -eq "1" ]]
+               then
+                       writef "${_cases},${_pass},${_fail},${_ignore},${_neg}"
+               else
+                       writef "${_cases},${_pass},${_fail},${_ignore}"
+               fi
                echo "${ResultLog}" > ${_filename}
                printf "\n${_filename}\n"
        fi
@@ -113,6 +120,7 @@ function testInit() {
        _fail=0
        _criticalFail=0
        _cases=0
+       _neg=0
        _filename=$(mktemp)
        _group=`basename "$1"`
        if [[ "${#_group}" -eq "0" ]]
@@ -149,6 +157,14 @@ function testResult() {
                fi
        fi
 
+       if [[ "${COUNTNEGATIVE}" -eq "1" ]]
+       then
+               if [[ "${2}\n" =~ "${COUNTNEGATIVEPOSTFIX}\n" ]]
+               then
+                       _neg=$((_neg+1))
+               fi
+       fi
+
        if [[ "${_good}" -eq "1" ]]
        then
                writef "${LightGreen}[PASSED]${NC} ${Green}$2${NC}:$3${NC}"
@@ -157,7 +173,7 @@ function testResult() {
                _fail=$((_fail+1))
                if [[ "${4}" == "1" ]]
                then
-                       writef "${Purple}[FAILED][Ignorable] $2${NC}:${Purple}$3${NC}"
+                       writef "${Purple}[IGNORED] $2${NC}:${Purple}$3${NC}"
                else
                        writef "${Red}[FAILED][Critical] $2${NC}:${Purple}$3${NC}"
                        _criticalFail=$((_criticalFail+1))