summaryrefslogtreecommitdiff
path: root/squad_client/core/models.py
diff options
context:
space:
mode:
authorAmro Hassaan <amro.hassaan@linaro.org>2020-03-12 09:40:15 -0400
committermwasilew <milosz.wasilewski@linaro.org>2020-03-12 13:54:48 +0000
commit1f99ab6fea0041953045256d8f8ac0ae6219c3a7 (patch)
treebcd49afb4c8c85931f55165831fe1846925b3552 /squad_client/core/models.py
parentb1b22bdd509a1f5f66d1b05a43b84d294cff8d99 (diff)
Add test status totals
core: models: add test status totals to TestRun.
Diffstat (limited to 'squad_client/core/models.py')
-rw-r--r--squad_client/core/models.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/squad_client/core/models.py b/squad_client/core/models.py
index 930db18..d9cdf45 100644
--- a/squad_client/core/models.py
+++ b/squad_client/core/models.py
@@ -245,8 +245,13 @@ class TestRun(SquadObject):
endpoint = '/api/testruns/'
attrs = ['url', 'id', 'metadata_file', 'log_file',
'created_at', 'completed', 'datetime', 'build_url',
- 'job_id', 'job_status', 'job_url', 'resubmit_url', 'data_processed',
- 'status_recorded', 'build', 'environment']
+ 'job_id', 'job_status', 'job_url', 'resubmit_url',
+ 'data_processed', 'status_recorded', 'build',
+ 'environment']
+ total_fail = 0
+ total_pass = 0
+ total_skip = 0
+ total_xfail = 0
def __setattr__(self, attr, value):
if attr == 'environment' and value.startswith('http'):
@@ -292,7 +297,18 @@ class TestRun(SquadObject):
for suite_name, tests in groupby(sorted(all_tests.values(), key=lambda t: t.name), lambda t: parse_test_name(t.name)[0]):
test_suite = TestRun.TestSuite()
test_suite.name = suite_name
- test_suite.tests = [t for t in tests]
+ tests_bucket = []
+ for test in tests:
+ tests_bucket.append(test)
+ if test.status == 'pass':
+ self.total_pass += 1
+ elif test.status == 'fail':
+ self.total_fail += 1
+ elif test.status == 'skip':
+ self.total_skip += 1
+ else:
+ self.total_xfail += 1
+ test_suite.tests = tests_bucket
self.test_suites.append(test_suite)
all_metrics = self.metrics()