bandit icon indicating copy to clipboard operation
bandit copied to clipboard

missing expected elements (e.g. errors, failures, testcase list, ... ) if no failures in xml output file

Open roalexan opened this issue 5 years ago • 4 comments

Several build tools require that the output files from various code analysis tools be in the junit-xml format. I can see how to output to xml using bandit, but not to junit xml format. Is there support for this?

roalexan avatar Aug 19 '20 16:08 roalexan

actually, the problem I'm hitting is not that it's not in junit-xml format, but rather that the file is missing some elements on a successful run. For example, I'm getting:

<?xml version='1.0' encoding='utf-8'?>
<testsuite name="bandit" tests="0" />

whereas I think it needs to look something like:

<?xml version="1.0" encoding="utf-8"?>
<testsuite errors="0" failures="0" name="bandit" skips="0" tests="1" time="2.523">
<testcase classname="bandit" file="bandit" line="1" name="bandit-py3_7-linux" time="2.523">
</testcase>
</testsuite>

How come on a successful run it doesn't include the number of tests, the time, and 0 for failures, errors, ans skips?

roalexan avatar Aug 20 '20 16:08 roalexan

actually, for now I'm going to replace the file with this (less than ideal):

<?xml version='1.0' encoding='utf-8'?>
<testsuite name="bandit" errors="0" failures="0" skipped="0" tests="1">
<testcase classname="bandit" name="bandit">
</testcase>
</testsuite>

roalexan avatar Aug 20 '20 16:08 roalexan

Hi, any updates on if junit xml format is planned?

0xjjoyy avatar Aug 11 '21 14:08 0xjjoyy