1

I have python unit test report generated by junit in xml fomrat from the jenkins.

<?xml version="1.0" encoding="utf-8"?>
<testsuites>
<testsuite name="pytest" errors="0" failures="0" skipped="1" tests="3" time="0.023" timestamp="2021-08-29T21:42:01.852698" hostname="infinity">
<testcase classname="tests.SimpleTest" name="test_fail" time="0.000" />
<testcase classname="tests.SimpleTest" name="test_pass" time="0.000" />
<testcase classname="tests.SimpleTest" name="test_skipped" time="0.000">
<skipped type="pytest.skip" message="demonstrating skipping">
/var/lib/jenkins/workspace/GithubExample/tests.py:10: demonstrating skipping
</skipped>
</testcase>
</testsuite>
</testsuites>

Now I want to generate an html report which then I can use Publish HTML report plugin to publish to be accessible from confluence.

Now at my workplace I do not have junit macro and maybe not have other html generation plugin what I have is xsltproc ,

I tried to generated htmlreport using xsltproc but it throws an error

xsltproc test-result.xml stylesheet.xslt > index.html
warning: failed to load external entity "test-result.xml"
cannot parse test-result.xml

1 Answer 1

1

You can use junit2html. It is easy to use and provides a few options to print tests summary to terminal output or create a summary in the html too.

Even though it is a python module, you can execute it from shell.

Example: junit2html report.xml report.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.