summaryrefslogtreecommitdiffstats
path: root/testcases/testcase.py
diff options
context:
space:
mode:
authorMaryam Tahhan <maryam.tahhan@intel.com>2016-05-11 10:21:59 +0100
committerMaryam Tahhan <maryam.tahhan@intel.com>2016-05-11 15:19:16 +0100
commit3460fd9b5379b288b34c6e2c5984d2e9f67cc3bd (patch)
tree195bee13a1ef50334dd16d54b87fe9f54ae5689d /testcases/testcase.py
parentfec2b7afe7cb98ae923bbd5a9d363038199ad0bb (diff)
testcase: execution time
Measure the execution time for a testcase and add it to the log. We need to report the test execution times for the testcases for OPNFV release C. Modified the timing result in the csv + results file to display a H:M:S format. Change-Id: Ife9e361da5f8b3fc3721050ae3e6dce049f7402d Signed-off-by: Maryam Tahhan <maryam.tahhan@intel.com> Reviewed-by: Christian Trautman <ctrautma@redhat.com> Reviewed-by: Martin Klozik <martinx.klozik@intel.com> Reviewed-by: Al Morton <acmorton@att.com>
Diffstat (limited to 'testcases/testcase.py')
-rw-r--r--testcases/testcase.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/testcases/testcase.py b/testcases/testcase.py
index 5b9ead69..1437aeae 100644
--- a/testcases/testcase.py
+++ b/testcases/testcase.py
@@ -45,6 +45,7 @@ class TestCase(object):
values.
:param results_dir: Where the csv formatted results are written.
"""
+ self._testcase_start_time = time.time()
self._hugepages_mounted = False
self._traffic_ctl = None
self._vnf_ctl = None
@@ -56,6 +57,7 @@ class TestCase(object):
self.guest_loopback = []
self._settings_original = {}
self._settings_paths_modified = False
+ self._testcast_run_time = None
self._update_settings('VSWITCH', cfg.get('vSwitch', S.getValue('VSWITCH')))
self._update_settings('VNF', cfg.get('VNF', S.getValue('VNF')))
@@ -284,6 +286,9 @@ class TestCase(object):
# tear down test execution environment and log results
self.run_finalize()
+ self._testcase_run_time = time.strftime("%H:%M:%S",
+ time.gmtime(time.time() - self._testcase_start_time))
+ logging.info("Testcase execution time: " + self._testcase_run_time)
# report test results
self.run_report()
@@ -313,6 +318,7 @@ class TestCase(object):
item[ResultsConstants.ID] = self.name
item[ResultsConstants.DEPLOYMENT] = self.deployment
item[ResultsConstants.TRAFFIC_TYPE] = self._traffic['l3']['proto']
+ item[ResultsConstants.TEST_RUN_TIME] = self._testcase_run_time
if self._traffic['multistream']:
item[ResultsConstants.SCAL_STREAM_COUNT] = self._traffic['multistream']
item[ResultsConstants.SCAL_STREAM_TYPE] = self._traffic['stream_type']