From f2bbfb690ce435c389b548d6b299ff82f658ea80 Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Tue, 9 May 2017 12:06:57 +0200 Subject: Conform ODL with last framework updates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now ODL TestCase calculates the ratio between critical tests passed and failed and saves it in result. Non-critical test cases can fail as result doesn't take them into account [1]. It also updates default attribute values in TestCase and allows result to be float. [1] http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#setting-criticality Change-Id: Id4a89271b5b1a90cd3c1e2b08591ff26ffaffee0 Signed-off-by: Cédric Ollivier --- functest/opnfv_tests/sdn/odl/odl.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'functest/opnfv_tests/sdn/odl') diff --git a/functest/opnfv_tests/sdn/odl/odl.py b/functest/opnfv_tests/sdn/odl/odl.py index f92cb95da..e50d9c130 100755 --- a/functest/opnfv_tests/sdn/odl/odl.py +++ b/functest/opnfv_tests/sdn/odl/odl.py @@ -16,6 +16,8 @@ Example: $ python odl.py """ +from __future__ import division + import argparse import errno import fileinput @@ -100,7 +102,12 @@ class ODLTests(testcase.TestCase): result = robot.api.ExecutionResult(xml_file) visitor = ODLResultVisitor() result.visit(visitor) - self.result = result.suite.status + try: + self.result = 100 * ( + result.suite.statistics.critical.passed / + result.suite.statistics.critical.total) + except ZeroDivisionError: + self.__logger.error("No test has been ran") self.start_time = timestamp_to_secs(result.suite.starttime) self.stop_time = timestamp_to_secs(result.suite.endtime) self.details = {} -- cgit 1.2.3-korg