tobiko/report/build.sh
Federico Ressi f3b835a57b Add tox environment to generate HTML test case reports.
By typing below commands it generates HTML report file
of Python test case results:

 tox -e report

It generates 'report/build/testr_results.html' file.

To run test cases (for example scenario tests) and produce
report HTML file it is possible to chain tox environment
names in a list. For example:

 tox -e scenario,report

Or simply:

 tox -e scenario
 tox -e report

This new environment is intended to be used in CI jobs
to produce reports after verifications.

Change-Id: I63d4d2977fb5b2c868361aa00db0e1334f33fa10
2019-05-23 13:04:16 +02:00

20 lines
534 B
Bash
Executable File

#!/bin/sh
# Produce test HTML report file into ${REPORT_DIR}
set -xeu
TESTR_DIR=${TESTR_DIR:-$(pwd)}
BUILD_DIR=${BUILD_DIR:-${TESTR_DIR}/report/build}
SUBUNIT_FILE=${SUBUNIT_FILE:-${BUILD_DIR}/last.subunit}
TESTR_RESULTS_HTML=${TESTR_RESULTS_HTML:-${BUILD_DIR}/testr_results.html}
make_testr_results_html() {
mkdir -p "$(dirname ${SUBUNIT_FILE})"
(cd "${TESTR_DIR}" && stestr last --subunit) > "${SUBUNIT_FILE}"
(cd "${BUILD_DIR}" && subunit2html "${SUBUNIT_FILE}" "${TESTR_RESULTS_HTML}")
}
make_testr_results_html