Last active
October 9, 2021 20:56
-
-
Save abangser/59d3a72de592aaf0696353b55f7bec4f to your computer and use it in GitHub Desktop.
This gist is helpful during Chapter 8 of the TAU course
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
################################################################################################### | |
# This is extracting the values for each test suite description. # | |
# It uses awk to print the value between two quotes. # | |
# The columns printed is based on the following example string: # | |
# <testng-results ignored="0" total="23" passed="22" failed="1" skipped="0"> # | |
################################################################################################### | |
TEST_RESULTS_LOCATION="${1:-/home/runner/work/selenium-webdriver-java-course/selenium-webdriver-java-course/webdriver_java/target/surefire-reports}" | |
TEST_RESULTS_STRING=$(cat "${TEST_RESULTS_LOCATION}/testng-results.xml" | grep "<testng-results") | |
echo "IGNORED_TESTS=$(echo ${TEST_RESULTS_STRING} | awk -F'"' '{ print $2 }')" | |
echo "TOTAL_TESTS=$(echo ${TEST_RESULTS_STRING} | awk -F'"' '{ print $4 }')" | |
echo "PASSED_TESTS=$(echo ${TEST_RESULTS_STRING} | awk -F'"' '{ print $6 }')" | |
echo "FAILED_TESTS=$(echo ${TEST_RESULTS_STRING} | awk -F'"' '{ print $8 }')" | |
echo "SKIPPED_TESTS=$(echo ${TEST_RESULTS_STRING} | awk -F'"' '{ print $10 }')" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment