ci: increase nightly runs and add more info to test stats (#4378)

This commit is contained in:
Anton Iakimov 2023-11-24 17:42:44 +01:00 committed by GitHub
parent d73d1e2488
commit 2d251e9a08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 8 deletions

View File

@ -127,7 +127,7 @@ pipeline {
def getDefaultUnitTestCount() {
if (env.JOB_BASE_NAME == 'tests-nightly') {
return '10'
return '20'
}
return '1'
}

View File

@ -12,16 +12,21 @@ for file in glob.glob("**/report.xml", recursive=True):
for testcase in root.iter("testcase"):
test_name = testcase.attrib["name"]
test_stats[test_name]["total"] += 1
test_stats[test_name]["total_runs"] += 1
if testcase.find("failure") is not None:
test_stats[test_name]["failed"] += 1
test_stats[test_name]["failed_runs"] += 1
elif testcase.find("error") is not None:
test_stats[test_name]["failed"] += 1
test_stats[test_name]["failed_runs"] += 1
failing_test_stats = [
{"name": name, "failure_rate": stats["failed"] / stats["total"]}
for name, stats in test_stats.items() if stats["failed"] != 0
{
"name": name,
"failure_rate": stats["failed_runs"] / stats["total_runs"],
"failed_runs": stats["failed_runs"],
"total_runs": stats["total_runs"]
}
for name, stats in test_stats.items() if stats["failed_runs"] != 0
]
sorted_failing_test_stats = sorted(failing_test_stats,
@ -30,7 +35,11 @@ sorted_failing_test_stats = sorted(failing_test_stats,
print("---")
print("Failing tests stats")
print("(test name: failure rate)")
print("---")
for test_stat in sorted_failing_test_stats:
print(f"{test_stat['name']}: {test_stat['failure_rate'] * 100}%")
print("{}: {}% ({} of {} failed)".format(
test_stat['name'],
test_stat['failure_rate'] * 100,
test_stat['failed_runs'],
test_stat['total_runs']
))