Skip to content

Commit

Permalink
html/js: add passed, skipped, failed plot filters
Browse files Browse the repository at this point in the history
Passed / skipped tests are often uninteresting, so provide checkboxes to
filter the plot. A couple of other filters would be helpful in future:
- test name regex
- result diff (test fails for one testsuite but passes in other)

Signed-off-by: David Disseldorp <[email protected]>
  • Loading branch information
ddiss committed Oct 18, 2024
1 parent 635d7af commit 538e738
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
11 changes: 9 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
textarea { font-size: 12px; }
pre { font-size: .75em; }
em { font-size: .75em; }
label { display: inline; }
.testsuite-name, .testcase-name { max-width: 400px;overflow: hidden;display: inline-block;white-space: nowrap;text-overflow: ellipsis;vertical-align: middle; }
.testcase-name { max-width: 600px;}
.copy-link { float:right; margin-top: -2em;}
Expand Down Expand Up @@ -60,8 +61,14 @@ <h1>JUnit Parser</h1>

<div id="result"></div>
<div id="settings">
<input name="settingErrorIsFailure" id="settingErrorIsFailure" class="setting" type="checkbox" checked>
<label style="display: inline" for="settingErrorIsFailure">Treat errors as if they were failures.</label>
<input id="settingPlotPassed" class="setting" type="checkbox" checked>
<label for="settingPlotPassed">Plot passed tests.</label>
<input id="settingPlotSkipped" class="setting" type="checkbox" checked>
<label for="settingPlotSkipped">Plot skipped tests.</label>
<input id="settingPlotFailed" class="setting" type="checkbox" checked>
<label for="settingPlotFailed">Plot failed tests.</label>
<input id="settingErrorIsFailure" class="setting" type="checkbox" checked>
<label for="settingErrorIsFailure">Treat errors as if they were failures.</label>
</div>
<script src="junit_parser.js"></script>
</body>
Expand Down
10 changes: 10 additions & 0 deletions junit_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,16 @@
var rfill;
var title = null;

if ((!document.getElementById('settingPlotFailed').checked
&& (tc.failure || tc.error))
|| (!document.getElementById('settingPlotSkipped').checked
&& tc.skipped)
|| (!document.getElementById('settingPlotPassed').checked
&& !tc.failure && !tc.error && !tc.skipped)) {
//console.log("skipping due to filter:", tc);
continue;
}

if (tc.failure) {
title = tc.failure.message;
rfill = "rgba(212, 22, 16)"; // red
Expand Down

0 comments on commit 538e738

Please sign in to comment.