diff options
author | Morgan Richomme <morgan.richomme@orange.com> | 2016-05-19 14:41:23 +0200 |
---|---|---|
committer | Morgan Richomme <morgan.richomme@orange.com> | 2016-05-19 14:44:36 +0200 |
commit | d9d3645559462a4139ee33f0cca3be12e37b2d36 (patch) | |
tree | 020870700567e85cf77e36d697c05a2cfa8be4c0 /utils/test/reporting/functest/testCase.py | |
parent | 80014d7bb5932998e95ca37729b68938fb28fe9f (diff) |
Adapt reporting after Functest refactoring
Get test cases from cases declares in Tiers
Consider only Tier 0-3 to validate scenario
Display results for Tier > 3
Change-Id: I581702bd7f2cc323d38b82a2404b301fb8fd7840
Signed-off-by: Morgan Richomme <morgan.richomme@orange.com>
Diffstat (limited to 'utils/test/reporting/functest/testCase.py')
-rw-r--r-- | utils/test/reporting/functest/testCase.py | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/utils/test/reporting/functest/testCase.py b/utils/test/reporting/functest/testCase.py new file mode 100644 index 000000000..f6ab95a05 --- /dev/null +++ b/utils/test/reporting/functest/testCase.py @@ -0,0 +1,106 @@ +#!/usr/bin/python +# +# This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +import re + + +class TestCase(object): + + def __init__(self, name, project, constraints, + criteria=-1, isRunnable=True, tier=-1): + self.name = name + self.project = project + self.constraints = constraints + self.criteria = criteria + self.isRunnable = isRunnable + self.tier = tier + + def getName(self): + return self.name + + def getProject(self): + return self.project + + def getConstraints(self): + return self.constraints + + def getCriteria(self): + return self.criteria + + def getTier(self): + return self.tier + + def setCriteria(self, criteria): + self.criteria = criteria + + def setIsRunnable(self, isRunnable): + self.isRunnable = isRunnable + + def checkRunnable(self, installer, scenario, config): + # Re-use Functest declaration + # Retrieve Functest configuration file functest_config.yaml + is_runnable = True + config_test = config + # print " *********************** " + # print TEST_ENV + # print " ---------------------- " + # print "case = " + self.name + # print "installer = " + installer + # print "scenario = " + scenario + # print "project = " + self.project + + # Retrieve test constraints + # Retrieve test execution param + test_execution_context = {"installer": installer, + "scenario": scenario} + + # By default we assume that all the tests are always runnable... + # if test_env not empty => dependencies to be checked + if config_test is not None and len(config_test) > 0: + # possible criteria = ["installer", "scenario"] + # consider test criteria from config file + # compare towards CI env through CI en variable + for criteria in config_test: + if re.search(config_test[criteria], + test_execution_context[criteria]) is None: + # print "Test "+ test + " cannot be run on the environment" + is_runnable = False + # print is_runnable + self.isRunnable = is_runnable + + def toString(self): + testcase = ("Name=" + self.name + ";Criteria=" + str(self.criteria) + + ";Project=" + self.project + ";Constraints=" + + str(self.constraints) + ";IsRunnable" + + str(self.isRunnable)) + return testcase + + def getDbName(self): + # Correspondance name of the test case / name in the DB + # ideally we should modify the DB to avoid such interface.... + # '<name in the config>':'<name in the DB>' + # I know it is uggly... + test_match_matrix = {'healthcheck': 'healthcheck', + 'vping_ssh': 'vPing', + 'vping_userdata': 'vPing_userdata', + 'odl': 'ODL', + 'onos': 'ONOS', + 'ovno': 'ovno', + 'tempest_smoke_serial': 'Tempest', + 'tempest_full_parallel': 'tempest_full_parallel', + 'rally_sanity': 'Rally', + 'bgpvpn': 'bgpvpn', + 'rally_full': 'rally_full', + 'vims': 'vIMS', + 'doctor': 'doctor-notification', + 'promise': 'promise' + } + try: + return test_match_matrix[self.name] + except: + return "unknown" |