aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/tests/functional
diff options
context:
space:
mode:
authorPatrice Buriez <patrice.buriez@intel.com>2018-12-17 19:22:16 +0100
committerPatrice Buriez <patrice.buriez@intel.com>2018-12-21 19:07:59 +0100
commit855e0532f9a58986fbb95e19ac42e90b53f031b3 (patch)
treea0362a42deaa5275f9cf73deef0375b86744785a /yardstick/tests/functional
parent6ab3d996abb23e4cd47dbaa8591577e019a84541 (diff)
Additional rework of NSB report
- Make format_for_jstree expect a list of metric names - Avoid displaying timestamps twice in initial data table - Sort metrics in initial data table - Display testcase name - Fix styling - Make better use of JS and jQuery features - Move event handler to JS file - Avoid adding multiple tbody elements into data table - Adjust unit tests and functional tests accordingly JIRA: YARDSTICK-1367 Topic: report/html_table (12 of 12) Change-Id: I85d853f8e392953cace67e94fa0af2e2492a2b86 Signed-off-by: Patrice Buriez <patrice.buriez@intel.com>
Diffstat (limited to 'yardstick/tests/functional')
-rw-r--r--yardstick/tests/functional/benchmark/core/test_report.py40
1 files changed, 27 insertions, 13 deletions
diff --git a/yardstick/tests/functional/benchmark/core/test_report.py b/yardstick/tests/functional/benchmark/core/test_report.py
index 401b97da9..5f060dd1e 100644
--- a/yardstick/tests/functional/benchmark/core/test_report.py
+++ b/yardstick/tests/functional/benchmark/core/test_report.py
@@ -23,9 +23,9 @@ GOOD_YAML_NAME = 'fake_name'
GOOD_TASK_ID = "9cbe74b6-df09-4535-8bdc-dc3a43b8a4e2"
GOOD_DB_FIELDKEYS = [
{u'fieldKey': u'metric1', u'fieldType': u'integer'},
+ {u'fieldKey': u'metric4', u'fieldType': u'integer'},
{u'fieldKey': u'metric2', u'fieldType': u'integer'},
{u'fieldKey': u'metric3', u'fieldType': u'integer'},
- {u'fieldKey': u'metric4', u'fieldType': u'integer'},
]
GOOD_DB_METRICS = [
{u'time': u'2018-08-20T16:49:26.372662016Z',
@@ -73,28 +73,42 @@ class ReportTestCase(unittest.TestCase):
with mock.patch.object(report.consts, 'DEFAULT_HTML_FILE', tmpfile.name):
report.Report().generate_nsb(params)
+ data_act = None
+ time_act = None
+ keys_act = None
+ tree_act = None
with open(tmpfile.name) as f:
for l in f.readlines():
- if " arr = {" in l:
- arr_act = ast.literal_eval(l.strip()[6:-1])
- elif " jstree_data = [" in l:
- jstree_data_act = ast.literal_eval(l.strip()[14:-1])
-
- arr_exp = {
- 'Timestamp':
- ['16:49:26.372662', '16:49:27.374208', '16:49:28.375742',
- '16:49:29.377299', '16:49:30.378252', '16:49:30.379359'],
+ if "var report_data = {" in l:
+ data_act = ast.literal_eval(l.strip()[18:-1])
+ elif "var report_time = [" in l:
+ time_act = ast.literal_eval(l.strip()[18:-1])
+ elif "var report_keys = [" in l:
+ keys_act = ast.literal_eval(l.strip()[18:-1])
+ elif "var report_tree = [" in l:
+ tree_act = ast.literal_eval(l.strip()[18:-1])
+
+ data_exp = {
'metric1': [1, 1, 2, 3, 5, 8],
'metric2': [0, 1, 2, 3, 4, 5],
'metric3': [8, 5, 3, 2, 1, 1],
'metric4': [5, 4, 3, 2, 1, 0],
}
- jstree_data_exp = [
+ time_exp = [
+ '16:49:26.372662', '16:49:27.374208', '16:49:28.375742',
+ '16:49:29.377299', '16:49:30.378252', '16:49:30.379359',
+ ]
+ keys_exp = [
+ 'metric1', 'metric2', 'metric3', 'metric4',
+ ]
+ tree_exp = [
{'parent': '#', 'text': 'metric1', 'id': 'metric1'},
{'parent': '#', 'text': 'metric2', 'id': 'metric2'},
{'parent': '#', 'text': 'metric3', 'id': 'metric3'},
{'parent': '#', 'text': 'metric4', 'id': 'metric4'},
]
- self.assertEqual(arr_exp, arr_act)
- self.assertEqual(jstree_data_exp, jstree_data_act)
+ self.assertEqual(data_exp, data_act)
+ self.assertEqual(time_exp, time_act)
+ self.assertEqual(keys_exp, keys_act)
+ self.assertEqual(tree_exp, tree_act)