Quick hack python to render the xml test output including times in a easy to read format.

This commit is contained in:
Michael Kaye 2022-02-24 14:47:23 +00:00
parent 779b5db363
commit fbf29f6f1e
2 changed files with 16 additions and 14 deletions

View File

@ -93,10 +93,7 @@ jobs:
- name: Read Results [org.matrix.android.sdk.session]
if: always()
id: get-comment-body-session
run: |
body="$(cat ./matrix-sdk-android/build/outputs/androidTest-results/connected/*.xml | grep "<testsuite" | sed "s@.*tests=\(.*\)time=.*@\1@")"
echo "::set-output name=session::passed=$body"
# package: org.matrix.android.sdk.account
run: python3 tools/ci/render_xml_output.py session ./matrix-sdk-android/build/outputs/androidTest-results/connected/*.xml
- name: Run integration tests for Matrix SDK [org.matrix.android.sdk.account] API[${{ matrix.api-level }}]
if: always()
uses: reactivecircus/android-emulator-runner@v2
@ -111,9 +108,7 @@ jobs:
- name: Read Results [org.matrix.android.sdk.account]
if: always()
id: get-comment-body-account
run: |
body="$(cat ./matrix-sdk-android/build/outputs/androidTest-results/connected/*.xml | grep "<testsuite" | sed "s@.*tests=\(.*\)time=.*@\1@")"
echo "::set-output name=account::passed=$body"
run: python3 tools/ci/render_xml_output.py account ./matrix-sdk-android/build/outputs/androidTest-results/connected/*.xml
# package: org.matrix.android.sdk.internal
- name: Run integration tests for Matrix SDK [org.matrix.android.sdk.internal] API[${{ matrix.api-level }}]
if: always()
@ -129,9 +124,7 @@ jobs:
- name: Read Results [org.matrix.android.sdk.internal]
if: always()
id: get-comment-body-internal
run: |
body="$(cat ./matrix-sdk-android/build/outputs/androidTest-results/connected/*.xml | grep "<testsuite" | sed "s@.*tests=\(.*\)time=.*@\1@")"
echo "::set-output name=internal::passed=$body"
run: python3 tools/ci/render_xml_output.py internal ./matrix-sdk-android/build/outputs/androidTest-results/connected/*.xml
# package: org.matrix.android.sdk.ordering
- name: Run integration tests for Matrix SDK [org.matrix.android.sdk.ordering] API[${{ matrix.api-level }}]
if: always()
@ -162,7 +155,7 @@ jobs:
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
emulator-build: 7425822
script: ./gradlew $CI_GRADLE_ARG_PROPERTIES -Pandroid.testInstrumentationRunnerArguments.class='org.matrix.android.sdk.PermalinkParserTest' matrix-sdk-android:connectedDebugAndroidTest
- name: Read Results [org.matrix.android.sd.PermalinkParserTest]
- name: Read Results [org.matrix.android.sdk.PermalinkParserTest]
if: always()
id: get-comment-body-permalink
run: |

View File

@ -4,6 +4,7 @@
# Explicitly aims not to have any dependencies, to reduce installation load.
# Should just be able to run in the context of your standard github runner.
# Potentially rewrite as an independent action, use handlebars to template result
import sys
import xml.etree.ElementTree as ET
@ -15,9 +16,14 @@ for xmlfile in xmlfiles:
root = tree.getroot()
name = root.attrib['name']
name = root.attrib['time']
success = int(root.attrib['tests']) - int(root.attrib['failures']) - int(root.attrib['errors'])
total = int(root.attrib['tests']) - int(root.attrib['skipped'])
print(f"::group::{name} {success}/{total} in {time}")
tests = int(root.attrib['tests'])
passed = int(root.attrib['passed'])
skipped = int(root.attrib['skipped'])
errors = int(root.attrib['errors'])
failures = int(root.attrib['failures'])
success = tests - failures - errors - skipped
total = tests - skipped
print(f"::group::{name} {success}/{total} ({skipped} skipped) in {time}")
for testcase in root:
if testcase.tag != "testcase":
@ -31,4 +37,7 @@ for xmlfile in xmlfiles:
else:
print(f"::error file={testname}::{message} in {time}s")
print(child.text)
body = f"passed={passed} failures={failures} errors={errors} skipped={skipped}"
print(f"::set-output name={suitename}::passed={body}"
print("::endgroup::")