-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Aggregate all junit reports * Display summary instead of report * Add repository name for checkout action
- Loading branch information
1 parent
a8f58ca
commit 389a5f8
Showing
2 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import os | ||
import glob | ||
from junitparser import JUnitXml, TestSuite | ||
|
||
def aggregate_junit_reports(report_dir, output_report): | ||
aggregated = JUnitXml() | ||
aggregated.name = "Aggregated Tests" | ||
|
||
for file_path in glob.glob(os.path.join(report_dir, "**/report.xml"), recursive=True): | ||
xml = JUnitXml.fromfile(file_path) | ||
for suite in xml: | ||
if isinstance(suite, TestSuite): | ||
aggregated.add_testsuite(suite) | ||
|
||
aggregated.write(output_report) | ||
print(f"Aggregated report saved to {output_report}") | ||
|
||
if __name__ == "__main__": | ||
import os | ||
report_dir = os.getenv("REPORT_DIR", "./junit-reports") | ||
output_report = os.getenv("OUTPUT_FILE", "aggregated-report.xml") | ||
aggregate_junit_reports(report_dir, output_report) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters