From 2d251e9a08eea85dd788b1126d3aee54562a080b Mon Sep 17 00:00:00 2001 From: Anton Iakimov Date: Fri, 24 Nov 2023 17:42:44 +0100 Subject: [PATCH] ci: increase nightly runs and add more info to test stats (#4378) --- _assets/ci/Jenkinsfile.tests | 2 +- _assets/scripts/test_stats.py | 23 ++++++++++++++++------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/_assets/ci/Jenkinsfile.tests b/_assets/ci/Jenkinsfile.tests index b6597b904..6f63fcbc7 100644 --- a/_assets/ci/Jenkinsfile.tests +++ b/_assets/ci/Jenkinsfile.tests @@ -127,7 +127,7 @@ pipeline { def getDefaultUnitTestCount() { if (env.JOB_BASE_NAME == 'tests-nightly') { - return '10' + return '20' } return '1' } diff --git a/_assets/scripts/test_stats.py b/_assets/scripts/test_stats.py index b71d80105..50a572d1e 100755 --- a/_assets/scripts/test_stats.py +++ b/_assets/scripts/test_stats.py @@ -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'] + ))