From 2837f75d5093f550a099918e9f26acd68e6b55b0 Mon Sep 17 00:00:00 2001
From: Dion Moult
Date: Mon, 27 Jul 2020 18:37:05 +1000
Subject: [PATCH] BIMTester will now report unspecified tests with fancy
colours
---
src/ifcbimtester/bimtester.py | 11 +++++++++--
src/ifcbimtester/features/template.html | 6 ++++--
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/src/ifcbimtester/bimtester.py b/src/ifcbimtester/bimtester.py
index a9aacf309b..88c063e646 100644
--- a/src/ifcbimtester/bimtester.py
+++ b/src/ifcbimtester/bimtester.py
@@ -92,15 +92,22 @@ def generate_report():
steps = []
total_duration = 0
for step in scenario['steps']:
- total_duration += step['result']['duration']
+ if 'result' in step:
+ total_duration += step['result']['duration']
name = step['name']
- if 'arguments' in step['match']:
+ if 'match' in step and 'arguments' in step['match']:
for a in step['match']['arguments']:
name = name.replace(a['value'], '' + a['value'] + '')
+ if 'result' not in step or step['result']['status'] == 'undefined':
+ step['result'] = {}
+ step['result']['status'] = 'undefined'
+ step['result']['duration'] = 0
+ step['result']['error_message'] = 'This requirement has not yet been specified.'
steps.append({
'name': name,
'time': round(step['result']['duration'], 2),
'is_success': step['result']['status'] == 'passed',
+ 'is_unspecified': 'result' not in step or step['result']['status'] == 'undefined',
'error_message': None if step['result']['status'] == 'passed' else step['result']['error_message']
})
total_passes = len([s for s in steps if s['is_success'] == True])
diff --git a/src/ifcbimtester/features/template.html b/src/ifcbimtester/features/template.html
index b8c229a7ec..927180e89f 100644
--- a/src/ifcbimtester/features/template.html
+++ b/src/ifcbimtester/features/template.html
@@ -13,10 +13,12 @@
span.success { background-color: #97cc64; padding: 5px; border-radius: 5px; color: #FFF; font-weight: bold; }
span.failure { background-color: #fb5a3e; padding: 5px; border-radius: 5px; color: #FFF; font-weight: bold; }
p.failure { background-color: #fb5a3e; padding: 5px; border-radius: 5px; color: #fff; }
+ p.unspecified { background-color: #994f00; padding: 5px; border-radius: 5px; color: #fff; }
p.description { background-color: #eee; border-radius: 5px; padding: 20px; margin-left: auto; margin-right: auto; display: inline-block; font-weight: bold;}
li { padding: 10px; font-family: monospace; }
li.success { background-color: #b6cca1; color: #333; }
li.failure { background-color: #fbb4a8; color: #900; }
+ li.unspecified { background-color: #ffd37f; color: #a30; }
li p { margin-bottom: 0px; }
footer { color: #999; font-size: 0.8em; }
header { text-align: center; }
@@ -50,11 +52,11 @@
{{#steps}}
- -
+
-
{{{name}}}
{{time}}s
{{^is_success}}
-
+
{{error_message}}
{{/is_success}}