Skip to content

Latest commit

 

History

History
12 lines (11 loc) · 527 Bytes

readme.md

File metadata and controls

12 lines (11 loc) · 527 Bytes

Get unit test coverage

go test -covermode=count  -v -cover  ./...   -coverprofile=cover.out &&
            go tool cover -func=cover.out | grep total | awk '{print substr($3, 1, length($3)-3)}' | {
                read -r message; EXPECTED_COV=80;
                if [ "$message" -lt $EXPECTED_COV ];
                then  echo "FAILED, as Coverage is $message lesser then $EXPECTED_COV";
                else  echo "PASSED, as Coverage is $message greater then $EXPECTED_COV";
                fi
            }