From 082c1c79f5a84aeda8eee4f87d9f261089fb9e78 Mon Sep 17 00:00:00 2001 From: Jing <33887762+FiveDimensions@users.noreply.github.com> Date: Wed, 6 Nov 2019 23:03:17 +0800 Subject: [PATCH] [harness-automation] save case failure times (#4261) Save failure times for each case for judging if case passes randomly. --- tools/harness-automation/autothreadharness/runner.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/harness-automation/autothreadharness/runner.py b/tools/harness-automation/autothreadharness/runner.py index 036c9b79d..2b2c60a1d 100644 --- a/tools/harness-automation/autothreadharness/runner.py +++ b/tools/harness-automation/autothreadharness/runner.py @@ -106,10 +106,14 @@ class SimpleTestResult(unittest.TestResult): test (TestCase): The test just run passed (bool): Whether the case is passed """ + fails = self.result.get(test.__class__.__name__, {}).get('fails', 0) + if passed is False: + fails += 1 self.result[str(test.__class__.__name__)] = { 'started': self.started, 'stopped': time.strftime('%Y-%m-%dT%H:%M:%S'), 'passed': passed, + 'fails': fails, 'error': error, 'executions': SimpleTestResult.executions, }