aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xfunctest/ci/run_tests.py3
-rwxr-xr-xfunctest/ci/testcases.yaml96
-rw-r--r--functest/ci/tier_builder.py2
-rw-r--r--functest/core/feature.py74
-rw-r--r--functest/core/pytest_suite_runner.py4
-rw-r--r--functest/core/testcase.py6
-rw-r--r--functest/core/vnf_base.py9
-rw-r--r--functest/opnfv_tests/features/barometer.py6
-rw-r--r--functest/opnfv_tests/features/copper.py12
-rw-r--r--functest/opnfv_tests/features/doctor.py12
-rw-r--r--functest/opnfv_tests/features/domino.py12
-rw-r--r--functest/opnfv_tests/features/netready.py16
-rw-r--r--functest/opnfv_tests/features/odl_sfc.py14
-rw-r--r--functest/opnfv_tests/features/promise.py14
-rw-r--r--functest/opnfv_tests/features/sdnvpn.py14
-rw-r--r--functest/opnfv_tests/features/security_scan.py19
-rw-r--r--functest/opnfv_tests/mano/orchestra.py11
-rw-r--r--functest/opnfv_tests/openstack/rally/rally.py16
-rwxr-xr-xfunctest/opnfv_tests/openstack/refstack_client/refstack_client.py6
-rw-r--r--functest/opnfv_tests/openstack/snaps/api_check.py6
-rw-r--r--functest/opnfv_tests/openstack/snaps/connection_check.py6
-rw-r--r--functest/opnfv_tests/openstack/snaps/health_check.py6
-rw-r--r--functest/opnfv_tests/openstack/snaps/smoke.py6
-rw-r--r--functest/opnfv_tests/openstack/snaps/snaps_test_runner.py4
-rw-r--r--functest/opnfv_tests/openstack/tempest/tempest.py40
-rw-r--r--functest/opnfv_tests/openstack/vping/vping_base.py4
-rwxr-xr-xfunctest/opnfv_tests/openstack/vping/vping_ssh.py6
-rwxr-xr-xfunctest/opnfv_tests/openstack/vping/vping_userdata.py6
-rw-r--r--functest/opnfv_tests/sdn/onos/onos.py6
-rwxr-xr-xfunctest/opnfv_tests/vnf/aaa/aaa.py6
-rw-r--r--functest/opnfv_tests/vnf/ims/clearwater_ims_base.py7
-rw-r--r--functest/opnfv_tests/vnf/ims/cloudify_ims.py7
-rw-r--r--functest/opnfv_tests/vnf/rnc/parser.py12
-rw-r--r--functest/opnfv_tests/vnf/router/vyos_vrouter.py9
-rw-r--r--functest/tests/unit/ci/test_tier_builder.py2
-rw-r--r--functest/tests/unit/core/test_feature.py126
-rw-r--r--functest/tests/unit/core/test_testcase.py11
-rw-r--r--functest/tests/unit/features/test_barometer.py27
-rw-r--r--functest/tests/unit/features/test_copper.py17
-rw-r--r--functest/tests/unit/features/test_doctor.py18
-rw-r--r--functest/tests/unit/features/test_domino.py18
-rw-r--r--functest/tests/unit/features/test_netready.py19
-rw-r--r--functest/tests/unit/features/test_odl_sfc.py15
-rw-r--r--functest/tests/unit/features/test_promise.py18
-rw-r--r--functest/tests/unit/features/test_sdnvpn.py19
-rw-r--r--functest/tests/unit/features/test_security_scan.py20
-rw-r--r--functest/tests/unit/odl/test_odl.py2
-rw-r--r--functest/tests/unit/opnfv_tests/vnf/ims/test_ims_base.py (renamed from functest/tests/unit/opnfv_tests/vnf/ims/test_ims_base.by)6
-rw-r--r--functest/tests/unit/utils/test_functest_utils.py3
-rw-r--r--functest/tests/unit/vnf/__init__.py0
-rw-r--r--functest/tests/unit/vnf/rnc/__init__.py0
-rw-r--r--functest/tests/unit/vnf/rnc/test_parser.py40
-rw-r--r--functest/utils/functest_utils.py2
-rwxr-xr-xrun_unit_tests.sh1
54 files changed, 459 insertions, 382 deletions
diff --git a/functest/ci/run_tests.py b/functest/ci/run_tests.py
index 5793c04a7..0ca73f369 100755
--- a/functest/ci/run_tests.py
+++ b/functest/ci/run_tests.py
@@ -144,7 +144,8 @@ def run_test(test, tier_name, testcases=None):
try:
module = importlib.import_module(run_dict['module'])
cls = getattr(module, run_dict['class'])
- test_case = cls(case_name=test_name)
+ test_dict = ft_utils.get_dict_by_test(test_name)
+ test_case = cls(**test_dict)
try:
kwargs = run_dict['args']
diff --git a/functest/ci/testcases.yaml b/functest/ci/testcases.yaml
index 23b214bb7..f717cdd5a 100755
--- a/functest/ci/testcases.yaml
+++ b/functest/ci/testcases.yaml
@@ -8,7 +8,8 @@ tiers:
operations in the VIM.
testcases:
-
- name: connection_check
+ case_name: connection_check
+ project_name: functest
criteria: 'status == "PASS"'
blocking: true
clean_flag: false
@@ -27,7 +28,8 @@ tiers:
class: 'ConnectionCheck'
-
- name: api_check
+ case_name: api_check
+ project_name: functest
criteria: 'status == "PASS"'
blocking: true
clean_flag: false
@@ -45,7 +47,8 @@ tiers:
module: 'functest.opnfv_tests.openstack.snaps.api_check'
class: 'ApiCheck'
-
- name: snaps_health_check
+ case_name: snaps_health_check
+ project_name: functest
criteria: 'status == "PASS"'
blocking: true
clean_flag: false
@@ -68,7 +71,8 @@ tiers:
Set of basic Functional tests to validate the OPNFV scenarios.
testcases:
-
- name: vping_ssh
+ case_name: vping_ssh
+ project_name: functest
criteria: 'status == "PASS"'
blocking: true
clean_flag: true
@@ -84,7 +88,8 @@ tiers:
class: 'VPingSSH'
-
- name: vping_userdata
+ case_name: vping_userdata
+ project_name: functest
criteria: 'status == "PASS"'
blocking: true
clean_flag: true
@@ -99,7 +104,8 @@ tiers:
class: 'VPingUserdata'
-
- name: tempest_smoke_serial
+ case_name: tempest_smoke_serial
+ project_name: functest
criteria: 'success_rate == 100%'
blocking: false
clean_flag: true
@@ -116,7 +122,8 @@ tiers:
class: 'TempestSmokeSerial'
-
- name: rally_sanity
+ case_name: rally_sanity
+ project_name: functest
criteria: 'success_rate == 100%'
blocking: false
clean_flag: false
@@ -131,7 +138,8 @@ tiers:
class: 'RallySanity'
-
- name: refstack_defcore
+ case_name: refstack_defcore
+ project_name: functest
criteria: 'success_rate == 100%'
blocking: false
clean_flag: true
@@ -146,7 +154,8 @@ tiers:
class: 'RefstackClient'
-
- name: odl
+ case_name: odl
+ project_name: functest
criteria: 'success_rate == 100%'
blocking: true
clean_flag: false
@@ -166,7 +175,8 @@ tiers:
- /home/opnfv/repos/odl_test/csit/suites/openstack/neutron
-
- name: odl_netvirt
+ case_name: odl_netvirt
+ project_name: functest
criteria: 'success_rate == 100%'
blocking: false
clean_flag: false
@@ -188,7 +198,8 @@ tiers:
- /home/opnfv/repos/odl_test/csit/suites/openstack/connectivity
-
- name: fds
+ case_name: fds
+ project_name: functest
criteria: 'success_rate == 100%'
blocking: false
clean_flag: false
@@ -207,7 +218,8 @@ tiers:
- /home/opnfv/repos/fds/testing/robot
-
- name: onos
+ case_name: onos
+ project_name: functest
criteria: 'status == "PASS"'
blocking: true
clean_flag: true
@@ -223,7 +235,8 @@ tiers:
class: 'Onos'
-
- name: snaps_smoke
+ case_name: snaps_smoke
+ project_name: functest
criteria: 'status == "PASS"'
blocking: false
clean_flag: false
@@ -252,7 +265,8 @@ tiers:
integrated in functest
testcases:
-
- name: promise
+ case_name: promise
+ project_name: promise
criteria: 'success_rate == 100%'
blocking: false
clean_flag: true
@@ -266,7 +280,8 @@ tiers:
class: 'Promise'
-
- name: doctor
+ case_name: doctor-notification
+ project_name: doctor
criteria: 'status == "PASS"'
blocking: false
clean_flag: true
@@ -280,7 +295,8 @@ tiers:
class: 'Doctor'
-
- name: bgpvpn
+ case_name: bgpvpn
+ project_name: sdnvpn
criteria: 'status == "PASS"'
blocking: false
clean_flag: true
@@ -294,7 +310,8 @@ tiers:
class: 'SdnVpnTests'
-
- name: security_scan
+ case_name: security_scan
+ project_name: securityscanning
criteria: 'status == "PASS"'
blocking: false
clean_flag: true
@@ -308,7 +325,8 @@ tiers:
class: 'SecurityScan'
-
- name: multisite
+ case_name: multisite
+ project_name: multisite
criteria: 'success_rate == 100%'
blocking: false
clean_flag: false
@@ -321,7 +339,8 @@ tiers:
module: 'functest.opnfv_tests.openstack.tempest.tempest'
class: 'TempestMultisite'
-
- name: odl-sfc
+ case_name: functest-odl-sfc
+ project_name: sfc
criteria: 'status == "PASS"'
blocking: false
clean_flag: true
@@ -334,7 +353,8 @@ tiers:
module: 'functest.opnfv_tests.features.odl_sfc'
class: 'OpenDaylightSFC'
-
- name: onos_sfc
+ case_name: onos_sfc
+ project_name: functest
criteria: 'status == "PASS"'
blocking: true
clean_flag: true
@@ -347,7 +367,8 @@ tiers:
module: 'functest.opnfv_tests.sdn.onos.onos'
class: 'OnosSfc'
-
- name: parser
+ case_name: parser-basics
+ project_name: parser
criteria: 'ret == 0'
blocking: false
clean_flag: true
@@ -360,7 +381,8 @@ tiers:
module: 'functest.opnfv_tests.vnf.rnc.parser'
class: 'Parser'
-
- name: domino
+ case_name: domino-multinode
+ project_name: domino
criteria: 'status == "PASS"'
blocking: false
clean_flag: true
@@ -373,7 +395,8 @@ tiers:
module: 'functest.opnfv_tests.features.domino'
class: 'Domino'
-
- name: netready
+ case_name: gluon_vping
+ project_name: netready
criteria: 'status == "PASS"'
blocking: false
clean_flag: true
@@ -386,7 +409,8 @@ tiers:
module: 'functest.opnfv_tests.features.netready'
class: 'GluonVping'
-
- name: barometer
+ case_name: barometercollectd
+ project_name: barometer
criteria: 'status == "PASS"'
blocking: false
clean_flag: true
@@ -409,7 +433,8 @@ tiers:
Extensive testing of OpenStack API.
testcases:
-
- name: tempest_full_parallel
+ case_name: tempest_full_parallel
+ project_name: functest
criteria: 'success_rate >= 80%'
blocking: false
clean_flag: true
@@ -424,7 +449,8 @@ tiers:
module: 'functest.opnfv_tests.openstack.tempest.tempest'
class: 'TempestFullParallel'
-
- name: tempest_custom
+ case_name: tempest_custom
+ project_name: functest
criteria: 'success_rate == 100%'
blocking: false
clean_flag: true
@@ -441,7 +467,8 @@ tiers:
module: 'functest.opnfv_tests.openstack.tempest.tempest'
class: 'TempestCustom'
-
- name: rally_full
+ case_name: rally_full
+ project_name: functest
criteria: 'success_rate >= 90%'
blocking: false
clean_flag: false
@@ -463,7 +490,8 @@ tiers:
Collection of VNF test cases.
testcases:
-
- name: cloudify_ims
+ case_name: cloudify_ims
+ project_name: functest
criteria: 'status == "PASS"'
blocking: false
clean_flag: true
@@ -477,7 +505,8 @@ tiers:
module: 'functest.opnfv_tests.vnf.ims.cloudify_ims'
class: 'CloudifyIms'
# -
-# name: aaa
+# case_name: aaa
+# project_name: functest
# criteria: 'ret == 0'
# blocking: false
# clean_flag: true
@@ -490,7 +519,8 @@ tiers:
# module: 'functest.opnfv_tests.vnf.aaa.aaa'
# class: 'AaaVnf'
-
- name: orchestra_ims
+ case_name: orchestra_ims
+ project_name: functest
criteria: 'ret == 0'
blocking: false
clean_flag: true
@@ -504,7 +534,8 @@ tiers:
class: 'ImsVnf'
-
- name: opera_ims
+ case_name: opera-vims
+ project_name: opera
criteria: 'status == "PASS"'
blocking: false
clean_flag: true
@@ -518,7 +549,8 @@ tiers:
class: 'OperaIms'
-
- name: vyos_vrouter
+ case_name: vyos_vrouter
+ project_name: functest
criteria: 'status == "PASS"'
blocking: false
clean_flag: true
diff --git a/functest/ci/tier_builder.py b/functest/ci/tier_builder.py
index f4c6f70fd..44b272584 100644
--- a/functest/ci/tier_builder.py
+++ b/functest/ci/tier_builder.py
@@ -46,7 +46,7 @@ class TierBuilder(object):
scenario = dic_testcase['dependencies']['scenario']
dep = th.Dependency(installer, scenario)
- testcase = th.TestCase(name=dic_testcase['name'],
+ testcase = th.TestCase(name=dic_testcase['case_name'],
dependency=dep,
criteria=dic_testcase['criteria'],
blocking=dic_testcase['blocking'],
diff --git a/functest/core/feature.py b/functest/core/feature.py
index 5149f80fd..29e0e9273 100644
--- a/functest/core/feature.py
+++ b/functest/core/feature.py
@@ -1,6 +1,6 @@
import time
-import testcase as base
+import functest.core.testcase as base
import functest.utils.functest_utils as ft_utils
import functest.utils.functest_logger as ft_logger
from functest.utils.constants import CONST
@@ -8,55 +8,37 @@ from functest.utils.constants import CONST
class Feature(base.TestCase):
- def __init__(self, project='functest', case_name='', repo='', cmd=''):
- super(Feature, self).__init__(case_name=case_name)
- self.project_name = project
- self.cmd = cmd
- self.repo = CONST.__getattribute__(repo)
- self.result_file = self.get_result_file()
- self.logger = ft_logger.Logger(project).getLogger()
+ def __init__(self, **kwargs):
+ super(Feature, self).__init__(**kwargs)
+ self.cmd = kwargs.get('cmd', '')
+ self.result_file = "{}/{}.log".format(
+ CONST.__getattribute__('dir_results'), self.project_name)
+ self.logger = ft_logger.Logger(self.project_name).getLogger()
+
+ def execute(self, **kwargs):
+ return -1
def run(self, **kwargs):
- self.prepare()
self.start_time = time.time()
- ret = self.execute()
+ exit_code = base.TestCase.EX_RUN_ERROR
+ self.criteria = "FAIL"
+ try:
+ if self.execute() == 0:
+ exit_code = base.TestCase.EX_OK
+ self.criteria = 'PASS'
+ ft_utils.logger_test_results(
+ self.project_name, self.case_name,
+ self.criteria, self.details)
+ self.logger.info("%s %s", self.project_name, self.criteria)
+ except Exception: # pylint: disable=broad-except
+ self.logger.exception("%s FAILED", self.project_name)
+ self.logger.info("Test result is stored in '%s'", self.result_file)
self.stop_time = time.time()
- self.post()
- self.parse_results(ret)
- self.log_results()
- self.logger.info("Test result is stored in '%s'" % self.result_file)
- return base.TestCase.EX_OK
-
- def execute(self):
- '''
- Executer method that can be overwritten
- By default it executes a shell command.
- '''
- return ft_utils.execute_command(self.cmd, output_file=self.result_file)
-
- def prepare(self, **kwargs):
- pass
-
- def post(self, **kwargs):
- pass
-
- def parse_results(self, ret):
- exit_code = base.TestCase.EX_OK
- if ret == 0:
- self.logger.info("{} OK".format(self.project_name))
- self.criteria = 'PASS'
- else:
- self.logger.info("{} FAILED".format(self.project_name))
- exit_code = base.TestCase.EX_RUN_ERROR
- self.criteria = "FAIL"
-
return exit_code
- def get_result_file(self):
- return "{}/{}.log".format(CONST.dir_results, self.project_name)
- def log_results(self):
- ft_utils.logger_test_results(self.project_name,
- self.case_name,
- self.criteria,
- self.details)
+class BashFeature(Feature):
+
+ def execute(self, **kwargs):
+ return ft_utils.execute_command(
+ self.cmd, output_file=self.result_file)
diff --git a/functest/core/pytest_suite_runner.py b/functest/core/pytest_suite_runner.py
index 9cfaea7ae..775f0a66d 100644
--- a/functest/core/pytest_suite_runner.py
+++ b/functest/core/pytest_suite_runner.py
@@ -15,8 +15,8 @@ class PyTestSuiteRunner(base.TestCase):
This superclass is designed to execute pre-configured unittest.TestSuite()
objects
"""
- def __init__(self, case_name=''):
- super(PyTestSuiteRunner, self).__init__(case_name)
+ def __init__(self, **kwargs):
+ super(PyTestSuiteRunner, self).__init__(**kwargs)
self.suite = None
def run(self, **kwargs):
diff --git a/functest/core/testcase.py b/functest/core/testcase.py
index 8c5fd6476..3b43aefb3 100644
--- a/functest/core/testcase.py
+++ b/functest/core/testcase.py
@@ -27,10 +27,10 @@ class TestCase(object):
logger = ft_logger.Logger(__name__).getLogger()
- def __init__(self, case_name=""):
+ def __init__(self, **kwargs):
self.details = {}
- self.project_name = "functest"
- self.case_name = case_name
+ self.project_name = kwargs.get('project_name', 'functest')
+ self.case_name = kwargs.get('case_name', '')
self.criteria = ""
self.start_time = ""
self.stop_time = ""
diff --git a/functest/core/vnf_base.py b/functest/core/vnf_base.py
index 3d3a441f4..3c71ec77b 100644
--- a/functest/core/vnf_base.py
+++ b/functest/core/vnf_base.py
@@ -21,11 +21,10 @@ class VnfOnBoardingBase(base.TestCase):
logger = ft_logger.Logger(__name__).getLogger()
- def __init__(self, project='functest', case_name='', repo='', cmd=''):
- super(VnfOnBoardingBase, self).__init__(case_name=case_name)
- self.repo = repo
- self.project_name = project
- self.cmd = cmd
+ def __init__(self, **kwargs):
+ super(VnfOnBoardingBase, self).__init__(**kwargs)
+ self.repo = kwargs.get('repo', '')
+ self.cmd = kwargs.get('cmd', '')
self.details = {}
self.result_dir = CONST.dir_results
self.details['orchestrator'] = {}
diff --git a/functest/opnfv_tests/features/barometer.py b/functest/opnfv_tests/features/barometer.py
index 6207f5814..b42801d4b 100644
--- a/functest/opnfv_tests/features/barometer.py
+++ b/functest/opnfv_tests/features/barometer.py
@@ -16,10 +16,8 @@ class BarometerCollectd(base.Feature):
Class for executing barometercollectd testcase.
'''
- def __init__(self, case_name='barometercollectd'):
- super(BarometerCollectd, self).__init__(project='barometer',
- case_name=case_name,
- repo='dir_repo_barometer')
+ def __init__(self, **kwargs):
+ super(BarometerCollectd, self).__init__(**kwargs)
def execute(self):
return collectd.main(self.logger)
diff --git a/functest/opnfv_tests/features/copper.py b/functest/opnfv_tests/features/copper.py
index 5b88a4995..2c5459fc4 100644
--- a/functest/opnfv_tests/features/copper.py
+++ b/functest/opnfv_tests/features/copper.py
@@ -15,11 +15,11 @@
# limitations under the License.
#
import functest.core.feature as base
+from functest.utils.constants import CONST
-class Copper(base.Feature):
- def __init__(self, case_name='copper-notification'):
- super(Copper, self).__init__(project='copper',
- case_name=case_name,
- repo='dir_repo_copper')
- self.cmd = 'cd %s/tests && bash run.sh && cd -' % self.repo
+class Copper(base.BashFeature):
+ def __init__(self, **kwargs):
+ repo = CONST.__getattribute__('dir_repo_copper')
+ kwargs["cmd"] = 'cd %s/tests && bash run.sh && cd -' % repo
+ super(Copper, self).__init__(**kwargs)
diff --git a/functest/opnfv_tests/features/doctor.py b/functest/opnfv_tests/features/doctor.py
index fd181a040..0e39248d8 100644
--- a/functest/opnfv_tests/features/doctor.py
+++ b/functest/opnfv_tests/features/doctor.py
@@ -14,11 +14,11 @@
#
#
import functest.core.feature as base
+from functest.utils.constants import CONST
-class Doctor(base.Feature):
- def __init__(self, case_name='doctor-notification'):
- super(Doctor, self).__init__(project='doctor',
- case_name=case_name,
- repo='dir_repo_doctor')
- self.cmd = 'cd %s/tests && ./run.sh' % self.repo
+class Doctor(base.BashFeature):
+ def __init__(self, **kwargs):
+ repo = CONST.__getattribute__('dir_repo_doctor')
+ kwargs["cmd"] = 'cd %s/tests && ./run.sh' % repo
+ super(Doctor, self).__init__(**kwargs)
diff --git a/functest/opnfv_tests/features/domino.py b/functest/opnfv_tests/features/domino.py
index 1c620235c..b5def3f3b 100644
--- a/functest/opnfv_tests/features/domino.py
+++ b/functest/opnfv_tests/features/domino.py
@@ -15,11 +15,11 @@
# 0.4: refactoring to match Test abstraction class
import functest.core.feature as base
+from functest.utils.constants import CONST
-class Domino(base.Feature):
- def __init__(self, case_name='domino-multinode'):
- super(Domino, self).__init__(project='domino',
- case_name=case_name,
- repo='dir_repo_domino')
- self.cmd = 'cd %s && ./tests/run_multinode.sh' % self.repo
+class Domino(base.BashFeature):
+ def __init__(self, **kwargs):
+ repo = CONST.__getattribute__('dir_repo_domino')
+ kwargs["cmd"] = 'cd %s && ./tests/run_multinode.sh' % repo
+ super(Domino, self).__init__(**kwargs)
diff --git a/functest/opnfv_tests/features/netready.py b/functest/opnfv_tests/features/netready.py
index ada322c18..717a4a348 100644
--- a/functest/opnfv_tests/features/netready.py
+++ b/functest/opnfv_tests/features/netready.py
@@ -9,14 +9,14 @@
#
import functest.core.feature as base
+from functest.utils.constants import CONST
-class GluonVping(base.Feature):
+class GluonVping(base.BashFeature):
- def __init__(self, case_name='gluon_vping'):
- super(GluonVping, self).__init__(project='netready',
- case_name=case_name,
- repo='dir_repo_netready')
- dir_netready_functest = '{}/test/functest'.format(self.repo)
- self.cmd = ('cd %s && python ./gluon-test-suite.py' %
- dir_netready_functest)
+ def __init__(self, **kwargs):
+ repo = CONST.__getattribute__('dir_repo_netready')
+ dir_netready_functest = '{}/test/functest'.format(repo)
+ kwargs["cmd"] = ('cd %s && python ./gluon-test-suite.py' %
+ dir_netready_functest)
+ super(GluonVping, self).__init__(**kwargs)
diff --git a/functest/opnfv_tests/features/odl_sfc.py b/functest/opnfv_tests/features/odl_sfc.py
index f96683e36..f5ecf7334 100644
--- a/functest/opnfv_tests/features/odl_sfc.py
+++ b/functest/opnfv_tests/features/odl_sfc.py
@@ -8,13 +8,13 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
import functest.core.feature as base
+from functest.utils.constants import CONST
-class OpenDaylightSFC(base.Feature):
+class OpenDaylightSFC(base.BashFeature):
- def __init__(self, case_name='functest-odl-sfc'):
- super(OpenDaylightSFC, self).__init__(project='sfc',
- case_name=case_name,
- repo='dir_repo_sfc')
- dir_sfc_functest = '{}/sfc/tests/functest'.format(self.repo)
- self.cmd = 'cd %s && python ./run_tests.py' % dir_sfc_functest
+ def __init__(self, **kwargs):
+ repo = CONST.__getattribute__('dir_repo_sfc')
+ dir_sfc_functest = '{}/sfc/tests/functest'.format(repo)
+ kwargs["cmd"] = 'cd %s && python ./run_tests.py' % dir_sfc_functest
+ super(OpenDaylightSFC, self).__init__(**kwargs)
diff --git a/functest/opnfv_tests/features/promise.py b/functest/opnfv_tests/features/promise.py
index e3dc7fdf5..b9e128f05 100644
--- a/functest/opnfv_tests/features/promise.py
+++ b/functest/opnfv_tests/features/promise.py
@@ -13,12 +13,12 @@
# limitations under the License.
#
import functest.core.feature as base
+from functest.utils.constants import CONST
-class Promise(base.Feature):
- def __init__(self, case_name='promise'):
- super(Promise, self).__init__(project='promise',
- case_name=case_name,
- repo='dir_repo_promise')
- dir_promise_functest = '{}/promise/test/functest'.format(self.repo)
- self.cmd = 'cd %s && python ./run_tests.py' % dir_promise_functest
+class Promise(base.BashFeature):
+ def __init__(self, **kwargs):
+ repo = CONST.__getattribute__('dir_repo_promise')
+ dir_promise_functest = '{}/promise/test/functest'.format(repo)
+ kwargs["cmd"] = 'cd %s && python ./run_tests.py' % dir_promise_functest
+ super(Promise, self).__init__(**kwargs)
diff --git a/functest/opnfv_tests/features/sdnvpn.py b/functest/opnfv_tests/features/sdnvpn.py
index 5e9254a0b..10a97e926 100644
--- a/functest/opnfv_tests/features/sdnvpn.py
+++ b/functest/opnfv_tests/features/sdnvpn.py
@@ -8,13 +8,13 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
import functest.core.feature as base
+from functest.utils.constants import CONST
-class SdnVpnTests(base.Feature):
+class SdnVpnTests(base.BashFeature):
- def __init__(self, case_name='bgpvpn'):
- super(SdnVpnTests, self).__init__(project='sdnvpn',
- case_name=case_name,
- repo='dir_repo_sdnvpn')
- dir_sfc_functest = '{}/sdnvpn/test/functest'.format(self.repo)
- self.cmd = 'cd %s && python ./run_tests.py' % dir_sfc_functest
+ def __init__(self, **kwargs):
+ repo = CONST.__getattribute__('dir_repo_sdnvpn')
+ dir_sfc_functest = '{}/sdnvpn/test/functest'.format(repo)
+ kwargs["cmd"] = 'cd %s && python ./run_tests.py' % dir_sfc_functest
+ super(SdnVpnTests, self).__init__(**kwargs)
diff --git a/functest/opnfv_tests/features/security_scan.py b/functest/opnfv_tests/features/security_scan.py
index e72563808..8f167259c 100644
--- a/functest/opnfv_tests/features/security_scan.py
+++ b/functest/opnfv_tests/features/security_scan.py
@@ -12,13 +12,12 @@ import functest.core.feature as base
from functest.utils.constants import CONST
-class SecurityScan(base.Feature):
- def __init__(self, case_name='security_scan'):
- super(SecurityScan, self).__init__(project='securityscanning',
- case_name=case_name,
- repo='dir_repo_securityscan')
- self.cmd = ('. {0}/stackrc && '
- 'cd {1} && '
- 'python security_scan.py --config config.ini && '
- 'cd -'.format(CONST.dir_functest_conf,
- self.repo))
+class SecurityScan(base.BashFeature):
+ def __init__(self, **kwargs):
+ repo = CONST.__getattribute__('dir_repo_securityscan')
+ conf = CONST.__getattribute__('dir_functest_conf')
+ kwargs["cmd"] = ('. {0}/stackrc && '
+ 'cd {1} && '
+ 'python security_scan.py --config config.ini && '
+ 'cd -'.format(conf, repo))
+ super(SecurityScan, self).__init__(**kwargs)
diff --git a/functest/opnfv_tests/mano/orchestra.py b/functest/opnfv_tests/mano/orchestra.py
index a9cf0ae66..dea26efc3 100644
--- a/functest/opnfv_tests/mano/orchestra.py
+++ b/functest/opnfv_tests/mano/orchestra.py
@@ -16,9 +16,12 @@ import functest.core.feature as base
class Orchestra(base.Feature):
- def __init__(self):
- super(Orchestra, self).__init__(project='orchestra',
- case='orchestra',
- repo='dir_repo_orchestra')
+ def __init__(self, **kwargs):
+ if "project_name" not in kwargs:
+ kwargs["project_name"] = "orchestra"
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "orchestra"
+ kwargs['repo'] = 'dir_repo_orchestra'
+ super(Orchestra, self).__init__(**kwargs)
# TODO
# self.cmd = "%s/tests/run.sh %s/tests" % (self.repo, self.repo)
diff --git a/functest/opnfv_tests/openstack/rally/rally.py b/functest/opnfv_tests/openstack/rally/rally.py
index e7411c51d..ad8745c70 100644
--- a/functest/opnfv_tests/openstack/rally/rally.py
+++ b/functest/opnfv_tests/openstack/rally/rally.py
@@ -56,8 +56,8 @@ class RallyBase(testcase.TestCase):
RALLY_PRIVATE_SUBNET_CIDR = CONST.rally_subnet_cidr
RALLY_ROUTER_NAME = CONST.rally_router_name
- def __init__(self, case_name=''):
- super(RallyBase, self).__init__(case_name)
+ def __init__(self, **kwargs):
+ super(RallyBase, self).__init__(**kwargs)
self.mode = ''
self.summary = []
self.scenario_dir = ''
@@ -536,8 +536,10 @@ class RallyBase(testcase.TestCase):
class RallySanity(RallyBase):
- def __init__(self, case_name="rally_sanity"):
- super(RallySanity, self).__init__(case_name)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "rally_sanity"
+ super(RallySanity, self).__init__(**kwargs)
self.mode = 'sanity'
self.test_name = 'all'
self.smoke = True
@@ -545,8 +547,10 @@ class RallySanity(RallyBase):
class RallyFull(RallyBase):
- def __init__(self, case_name="rally_full"):
- super(RallyFull, self).__init__(case_name)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "rally_full"
+ super(RallyFull, self).__init__(**kwargs)
self.mode = 'full'
self.test_name = 'all'
self.smoke = False
diff --git a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py
index 441abfee3..c708a2230 100755
--- a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py
+++ b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py
@@ -25,8 +25,10 @@ logger = ft_logger.Logger("refstack_defcore").getLogger()
class RefstackClient(testcase.TestCase):
- def __init__(self, case_name="refstack_defcore"):
- super(RefstackClient, self).__init__(case_name)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "refstack_defcore"
+ super(RefstackClient, self).__init__(**kwargs)
self.FUNCTEST_TEST = CONST.dir_functest_test
self.CONF_PATH = CONST.refstack_tempest_conf_path
self.DEFCORE_LIST = CONST.refstack_defcore_list
diff --git a/functest/opnfv_tests/openstack/snaps/api_check.py b/functest/opnfv_tests/openstack/snaps/api_check.py
index dea1ca759..bceb7c1d3 100644
--- a/functest/opnfv_tests/openstack/snaps/api_check.py
+++ b/functest/opnfv_tests/openstack/snaps/api_check.py
@@ -20,8 +20,10 @@ class ApiCheck(SnapsTestRunner):
that exercise many of the OpenStack APIs within Keystone, Glance, Neutron,
and Nova
"""
- def __init__(self, case_name="api_check"):
- super(ApiCheck, self).__init__(case_name)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "api_check"
+ super(ApiCheck, self).__init__(**kwargs)
self.suite = unittest.TestSuite()
diff --git a/functest/opnfv_tests/openstack/snaps/connection_check.py b/functest/opnfv_tests/openstack/snaps/connection_check.py
index 57b74d4c2..0607beb32 100644
--- a/functest/opnfv_tests/openstack/snaps/connection_check.py
+++ b/functest/opnfv_tests/openstack/snaps/connection_check.py
@@ -20,8 +20,10 @@ class ConnectionCheck(SnapsTestRunner):
that simply obtain the different OpenStack clients and may perform
simple queries
"""
- def __init__(self, case_name="connection_check"):
- super(ConnectionCheck, self).__init__(case_name)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "connection_check"
+ super(ConnectionCheck, self).__init__(**kwargs)
self.suite = unittest.TestSuite()
diff --git a/functest/opnfv_tests/openstack/snaps/health_check.py b/functest/opnfv_tests/openstack/snaps/health_check.py
index 6b3cfdd0d..245f50525 100644
--- a/functest/opnfv_tests/openstack/snaps/health_check.py
+++ b/functest/opnfv_tests/openstack/snaps/health_check.py
@@ -21,8 +21,10 @@ class HealthCheck(SnapsTestRunner):
creates a VM with a single port with an IPv4 address that is assigned by
DHCP. This test then validates the expected IP with the actual
"""
- def __init__(self, case_name="snaps_health_check"):
- super(HealthCheck, self).__init__(case_name)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "snaps_health_check"
+ super(HealthCheck, self).__init__(**kwargs)
self.suite = unittest.TestSuite()
diff --git a/functest/opnfv_tests/openstack/snaps/smoke.py b/functest/opnfv_tests/openstack/snaps/smoke.py
index 63d5c1223..ceead6bb1 100644
--- a/functest/opnfv_tests/openstack/snaps/smoke.py
+++ b/functest/opnfv_tests/openstack/snaps/smoke.py
@@ -21,8 +21,10 @@ class SnapsSmoke(SnapsTestRunner):
that exercise many of the OpenStack APIs within Keystone, Glance, Neutron,
and Nova
"""
- def __init__(self, case_name="snaps_smoke"):
- super(SnapsSmoke, self).__init__(case_name)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "snaps_smoke"
+ super(SnapsSmoke, self).__init__(**kwargs)
self.suite = unittest.TestSuite()
use_fip = CONST.snaps_use_floating_ips
diff --git a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py
index 044a0bb04..2068852e3 100644
--- a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py
+++ b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py
@@ -19,8 +19,8 @@ class SnapsTestRunner(PyTestSuiteRunner):
creates a VM with a single port with an IPv4 address that is assigned by
DHCP. This test then validates the expected IP with the actual
"""
- def __init__(self, case_name=''):
- super(SnapsTestRunner, self).__init__(case_name)
+ def __init__(self, **kwargs):
+ super(SnapsTestRunner, self).__init__(**kwargs)
self.ext_net_name = snaps_utils.get_ext_net_name()
self.logger = ft_logger.Logger(self.project_name).getLogger()
diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py
index c3184e352..8b175c250 100644
--- a/functest/opnfv_tests/openstack/tempest/tempest.py
+++ b/functest/opnfv_tests/openstack/tempest/tempest.py
@@ -28,8 +28,8 @@ logger = ft_logger.Logger("Tempest").getLogger()
class TempestCommon(testcase.TestCase):
- def __init__(self, case_name=''):
- super(TempestCommon, self).__init__(case_name)
+ def __init__(self, **kwargs):
+ super(TempestCommon, self).__init__(**kwargs)
self.MODE = ""
self.OPTION = ""
self.VERIFIER_ID = conf_utils.get_verifier_id()
@@ -234,31 +234,39 @@ class TempestCommon(testcase.TestCase):
class TempestSmokeSerial(TempestCommon):
- def __init__(self, case_name='tempest_smoke_serial'):
- TempestCommon.__init__(self, case_name)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = 'tempest_smoke_serial'
+ TempestCommon.__init__(self, **kwargs)
self.MODE = "smoke"
self.OPTION = "--concurrency 1"
class TempestSmokeParallel(TempestCommon):
- def __init__(self, case_name='tempest_smoke_parallel'):
- TempestCommon.__init__(self, case_name)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = 'tempest_smoke_parallel'
+ TempestCommon.__init__(self, **kwargs)
self.MODE = "smoke"
self.OPTION = ""
class TempestFullParallel(TempestCommon):
- def __init__(self, case_name="tempest_full_parallel"):
- TempestCommon.__init__(self, case_name)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = 'tempest_full_parallel'
+ TempestCommon.__init__(self, **kwargs)
self.MODE = "full"
class TempestMultisite(TempestCommon):
- def __init__(self, case_name="multisite"):
- TempestCommon.__init__(self, case_name)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = 'multisite'
+ TempestCommon.__init__(self, **kwargs)
self.MODE = "feature_multisite"
self.OPTION = "--concurrency 1"
conf_utils.install_verifier_ext(CONST.dir_repo_kingbird)
@@ -266,15 +274,19 @@ class TempestMultisite(TempestCommon):
class TempestCustom(TempestCommon):
- def __init__(self, case_name="tempest_custom"):
- TempestCommon.__init__(self, case_name)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = 'tempest_custom'
+ TempestCommon.__init__(self, **kwargs)
self.MODE = "custom"
self.OPTION = "--concurrency 1"
class TempestDefcore(TempestCommon):
- def __init__(self, case_name="tempest_defcore"):
- TempestCommon.__init__(self, case_name)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = 'tempest_defcore'
+ TempestCommon.__init__(self, **kwargs)
self.MODE = "defcore"
self.OPTION = "--concurrency 1"
diff --git a/functest/opnfv_tests/openstack/vping/vping_base.py b/functest/opnfv_tests/openstack/vping/vping_base.py
index 64cb0004d..8f7cc1d22 100644
--- a/functest/opnfv_tests/openstack/vping/vping_base.py
+++ b/functest/opnfv_tests/openstack/vping/vping_base.py
@@ -18,8 +18,8 @@ from functest.utils.constants import CONST
class VPingBase(testcase.TestCase):
- def __init__(self, case_name=''):
- super(VPingBase, self).__init__(case_name)
+ def __init__(self, **kwargs):
+ super(VPingBase, self).__init__(**kwargs)
self.logger = None
self.functest_repo = CONST.dir_repo_functest
self.repo = CONST.dir_vping
diff --git a/functest/opnfv_tests/openstack/vping/vping_ssh.py b/functest/opnfv_tests/openstack/vping/vping_ssh.py
index a68b0ff75..c26c4e0c0 100755
--- a/functest/opnfv_tests/openstack/vping/vping_ssh.py
+++ b/functest/opnfv_tests/openstack/vping/vping_ssh.py
@@ -24,8 +24,10 @@ import functest.core.testcase as testcase
class VPingSSH(vping_base.VPingBase):
- def __init__(self, case_name='vping_ssh'):
- super(VPingSSH, self).__init__(case_name)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "vping_ssh"
+ super(VPingSSH, self).__init__(**kwargs)
self.logger = ft_logger.Logger(self.case_name).getLogger()
def do_vping(self, vm, test_ip):
diff --git a/functest/opnfv_tests/openstack/vping/vping_userdata.py b/functest/opnfv_tests/openstack/vping/vping_userdata.py
index e9b869983..1b00ca23a 100755
--- a/functest/opnfv_tests/openstack/vping/vping_userdata.py
+++ b/functest/opnfv_tests/openstack/vping/vping_userdata.py
@@ -18,8 +18,10 @@ import vping_base
class VPingUserdata(vping_base.VPingBase):
- def __init__(self, case_name='vping_userdata'):
- super(VPingUserdata, self).__init__(case_name)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "vping_userdata"
+ super(VPingUserdata, self).__init__(**kwargs)
self.logger = ft_logger.Logger(self.case_name).getLogger()
def boot_vm_preparation(self, config, vmname, test_ip):
diff --git a/functest/opnfv_tests/sdn/onos/onos.py b/functest/opnfv_tests/sdn/onos/onos.py
index fe37669a4..fe496c1f3 100644
--- a/functest/opnfv_tests/sdn/onos/onos.py
+++ b/functest/opnfv_tests/sdn/onos/onos.py
@@ -49,8 +49,10 @@ class OnosBase(testcase.TestCase):
class Onos(OnosBase):
- def __init__(self, case_name='onos'):
- super(Onos, self).__init__(case_name)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "onos"
+ super(Onos, self).__init__(**kwargs)
self.log_path = os.path.join(self.onos_repo_path, 'TestON/logs')
def set_onos_ip(self):
diff --git a/functest/opnfv_tests/vnf/aaa/aaa.py b/functest/opnfv_tests/vnf/aaa/aaa.py
index f80e7bcc0..6de65bcd8 100755
--- a/functest/opnfv_tests/vnf/aaa/aaa.py
+++ b/functest/opnfv_tests/vnf/aaa/aaa.py
@@ -20,8 +20,10 @@ class AaaVnf(vnf_base.VnfOnBoardingBase):
logger = ft_logger.Logger("VNF AAA").getLogger()
- def __init__(self):
- super(AaaVnf, self).__init__(case_name="aaa")
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "aaa"
+ super(AaaVnf, self).__init__(**kwargs)
def deploy_orchestrator(self):
self.logger.info("No VNFM needed to deploy a free radius here")
diff --git a/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py b/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py
index 2fc5449cf..494633f4f 100644
--- a/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py
+++ b/functest/opnfv_tests/vnf/ims/clearwater_ims_base.py
@@ -20,13 +20,12 @@ import functest.utils.functest_utils as ft_utils
class ClearwaterOnBoardingBase(vnf_base.VnfOnBoardingBase):
- def __init__(self, project='functest', case='', repo='', cmd=''):
+ def __init__(self, **kwargs):
self.logger = ft_logger.Logger(__name__).getLogger()
- super(ClearwaterOnBoardingBase, self).__init__(
- project, case, repo, cmd)
+ super(ClearwaterOnBoardingBase, self).__init__(**kwargs)
self.case_dir = os.path.join(CONST.dir_functest_test, 'vnf', 'ims')
self.data_dir = CONST.dir_ims_data
- self.result_dir = os.path.join(CONST.dir_results, case)
+ self.result_dir = os.path.join(CONST.dir_results, self.case_name)
self.test_dir = CONST.dir_repo_vims_test
if not os.path.exists(self.data_dir):
diff --git a/functest/opnfv_tests/vnf/ims/cloudify_ims.py b/functest/opnfv_tests/vnf/ims/cloudify_ims.py
index d739335dc..e351e0d96 100644
--- a/functest/opnfv_tests/vnf/ims/cloudify_ims.py
+++ b/functest/opnfv_tests/vnf/ims/cloudify_ims.py
@@ -25,9 +25,10 @@ import functest.utils.openstack_utils as os_utils
class CloudifyIms(clearwater_ims_base.ClearwaterOnBoardingBase):
- def __init__(self, project='functest', case_name='cloudify_ims',
- repo='', cmd=''):
- super(CloudifyIms, self).__init__(project, case_name, repo, cmd)
+ def __init__(self, **kwargs):
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "cloudify_ims"
+ super(CloudifyIms, self).__init__(**kwargs)
self.logger = ft_logger.Logger(__name__).getLogger()
# Retrieve the configuration
diff --git a/functest/opnfv_tests/vnf/rnc/parser.py b/functest/opnfv_tests/vnf/rnc/parser.py
index 133145d74..3e6b138c2 100644
--- a/functest/opnfv_tests/vnf/rnc/parser.py
+++ b/functest/opnfv_tests/vnf/rnc/parser.py
@@ -16,11 +16,11 @@
#
import functest.core.feature as base
+from functest.utils.constants import CONST
-class Parser(base.Feature):
- def __init__(self):
- super(Parser, self).__init__(project='parser',
- case='parser-basics',
- repo='dir_repo_parser')
- self.cmd = 'cd %s/tests && ./functest_run.sh' % self.repo
+class Parser(base.BashFeature):
+ def __init__(self, **kwargs):
+ repo = CONST.__getattribute__('dir_repo_parser')
+ kwargs["cmd"] = 'cd %s/tests && ./functest_run.sh' % repo
+ super(Parser, self).__init__(**kwargs)
diff --git a/functest/opnfv_tests/vnf/router/vyos_vrouter.py b/functest/opnfv_tests/vnf/router/vyos_vrouter.py
index e188c3fbb..e6d2284df 100644
--- a/functest/opnfv_tests/vnf/router/vyos_vrouter.py
+++ b/functest/opnfv_tests/vnf/router/vyos_vrouter.py
@@ -14,10 +14,11 @@ RESULT_DETAILS_FILE = "test_result.json"
class VrouterVnf(base.Feature):
- def __init__(self):
- super(VrouterVnf, self).__init__(project='functest',
- case='vyos_vrouter',
- repo='dir_repo_vrouter')
+ def __init__(self, **kwargs):
+ kwargs["repo"] = 'dir_repo_vrouter'
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "vyos_vrouter"
+ super(VrouterVnf, self).__init__(**kwargs)
self.cmd = 'cd %s && ./run.sh' % self.repo
def set_result_details(self):
diff --git a/functest/tests/unit/ci/test_tier_builder.py b/functest/tests/unit/ci/test_tier_builder.py
index 48c94a57d..438fa7c25 100644
--- a/functest/tests/unit/ci/test_tier_builder.py
+++ b/functest/tests/unit/ci/test_tier_builder.py
@@ -22,7 +22,7 @@ class TierBuilderTesting(unittest.TestCase):
'scenario': 'test_scenario'}
self.testcase = {'dependencies': self.dependency,
- 'name': 'test_name',
+ 'case_name': 'test_name',
'criteria': 'test_criteria',
'blocking': 'test_blocking',
'clean_flag': 'test_clean_flag',
diff --git a/functest/tests/unit/core/test_feature.py b/functest/tests/unit/core/test_feature.py
index 0ed178a1d..ac4b04c44 100644
--- a/functest/tests/unit/core/test_feature.py
+++ b/functest/tests/unit/core/test_feature.py
@@ -16,92 +16,68 @@ import mock
from functest.core import feature
from functest.core import testcase
-from functest.utils import constants
+logging.disable(logging.CRITICAL)
-class FeatureInitTesting(unittest.TestCase):
- logging.disable(logging.CRITICAL)
+class FeatureTestingBase(unittest.TestCase):
- @unittest.skip("JIRA: FUNCTEST-780")
- def test_init_with_wrong_repo(self):
- with self.assertRaises(ValueError):
- feature.Feature(repo='foo')
+ _case_name = "foo"
+ _project_name = "bar"
+ _repo = "dir_repo_copper"
+ _cmd = "cd /home/opnfv/repos/foo/tests && bash run.sh && cd -"
+ _output_file = '/home/opnfv/functest/results/bar.log'
- def test_init(self):
- barometer = feature.Feature(repo='dir_repo_barometer')
- self.assertEqual(barometer.project_name, "functest")
- self.assertEqual(barometer.case_name, "")
- self.assertEqual(
- barometer.repo,
- constants.CONST.__getattribute__('dir_repo_barometer'))
+ @mock.patch('time.time', side_effect=[1, 2])
+ def _test_run(self, status, mock_method=None):
+ self.assertEqual(self.feature.run(), status)
+ if status == testcase.TestCase.EX_OK:
+ self.assertEqual(self.feature.criteria, 'PASS')
+ else:
+ self.assertEqual(self.feature.criteria, 'FAIL')
+ mock_method.assert_has_calls([mock.call(), mock.call()])
+ self.assertEqual(self.feature.start_time, 1)
+ self.assertEqual(self.feature.stop_time, 2)
-class FeatureTesting(unittest.TestCase):
-
- logging.disable(logging.CRITICAL)
+class FeatureTesting(FeatureTestingBase):
def setUp(self):
- self.feature = feature.Feature(repo='dir_repo_barometer')
-
- @unittest.skip("JIRA: FUNCTEST-781")
- def test_prepare_ko(self):
- # pylint: disable=bad-continuation
- with mock.patch.object(
- self.feature, 'prepare',
- return_value=testcase.TestCase.EX_RUN_ERROR) as mock_object:
- self.assertEqual(self.feature.run(),
- testcase.TestCase.EX_RUN_ERROR)
- mock_object.assert_called_once_with()
-
- @unittest.skip("JIRA: FUNCTEST-781")
- def test_prepare_exc(self):
- with mock.patch.object(self.feature, 'prepare',
- side_effect=Exception) as mock_object:
- self.assertEqual(self.feature.run(),
- testcase.TestCase.EX_RUN_ERROR)
- mock_object.assert_called_once_with()
-
- @unittest.skip("JIRA: FUNCTEST-781")
- def test_post_ko(self):
- # pylint: disable=bad-continuation
- with mock.patch.object(
- self.feature, 'post',
- return_value=testcase.TestCase.EX_RUN_ERROR) as mock_object:
- self.assertEqual(self.feature.run(),
- testcase.TestCase.EX_RUN_ERROR)
- mock_object.assert_called_once_with()
-
- @unittest.skip("JIRA: FUNCTEST-781")
- def test_post_exc(self):
- with mock.patch.object(self.feature, 'post',
- side_effect=Exception) as mock_object:
- self.assertEqual(self.feature.run(),
- testcase.TestCase.EX_RUN_ERROR)
- mock_object.assert_called_once_with()
-
- @unittest.skip("JIRA: FUNCTEST-778")
- def test_execute_ko(self):
- with mock.patch.object(self.feature, 'execute',
- return_value=1) as mock_object:
- self.assertEqual(self.feature.run(),
- testcase.TestCase.EX_RUN_ERROR)
- mock_object.assert_called_once_with()
-
- @unittest.skip("JIRA: FUNCTEST-778")
- def test_execute_exc(self):
- with mock.patch.object(self.feature, 'execute',
- side_effect=Exception) as mock_object:
- self.assertEqual(self.feature.run(),
- testcase.TestCase.EX_RUN_ERROR)
- mock_object.assert_called_once_with()
+ self.feature = feature.Feature(
+ project_name=self._project_name, case_name=self._case_name,
+ cmd=self._cmd)
def test_run(self):
- with mock.patch.object(self.feature, 'execute',
- return_value=0) as mock_object:
- self.assertEqual(self.feature.run(),
- testcase.TestCase.EX_OK)
- mock_object.assert_called_once_with()
+ self._test_run(testcase.TestCase.EX_RUN_ERROR)
+
+
+class BashFeatureTesting(FeatureTestingBase):
+
+ def setUp(self):
+ self.feature = feature.BashFeature(
+ project_name=self._project_name, case_name=self._case_name,
+ cmd=self._cmd)
+
+ @mock.patch("functest.utils.functest_utils.execute_command",
+ return_value=1)
+ def test_run_ko(self, mock_method=None):
+ self._test_run(testcase.TestCase.EX_RUN_ERROR)
+ mock_method.assert_called_once_with(
+ self._cmd, output_file=self._output_file)
+
+ @mock.patch("functest.utils.functest_utils.execute_command",
+ side_effect=Exception)
+ def test_run_exc(self, mock_method=None):
+ self._test_run(testcase.TestCase.EX_RUN_ERROR)
+ mock_method.assert_called_once_with(
+ self._cmd, output_file=self._output_file)
+
+ @mock.patch("functest.utils.functest_utils.execute_command",
+ return_value=0)
+ def test_run(self, mock_method):
+ self._test_run(testcase.TestCase.EX_OK)
+ mock_method.assert_called_once_with(
+ self._cmd, output_file=self._output_file)
if __name__ == "__main__":
diff --git a/functest/tests/unit/core/test_testcase.py b/functest/tests/unit/core/test_testcase.py
index 5ff41cd65..4f3b25ccd 100644
--- a/functest/tests/unit/core/test_testcase.py
+++ b/functest/tests/unit/core/test_testcase.py
@@ -27,10 +27,11 @@ class TestCaseTesting(unittest.TestCase):
logging.disable(logging.CRITICAL)
_case_name = "base"
+ _project_name = "functest"
def setUp(self):
- self.test = testcase.TestCase(case_name=self._case_name)
- self.test.project = "functest"
+ self.test = testcase.TestCase(case_name=self._case_name,
+ project_name=self._project_name)
self.test.start_time = "1"
self.test.stop_time = "2"
self.test.criteria = "PASS"
@@ -74,7 +75,7 @@ class TestCaseTesting(unittest.TestCase):
self.assertEqual(self.test.push_to_db(),
testcase.TestCase.EX_OK)
mock_function.assert_called_once_with(
- self.test.project, self._case_name, self.test.start_time,
+ self._project_name, self._case_name, self.test.start_time,
self.test.stop_time, self.test.criteria, self.test.details)
@mock.patch('functest.utils.functest_utils.push_results_to_db',
@@ -83,7 +84,7 @@ class TestCaseTesting(unittest.TestCase):
self.assertEqual(self.test.push_to_db(),
testcase.TestCase.EX_PUSH_TO_DB_ERROR)
mock_function.assert_called_once_with(
- self.test.project, self._case_name, self.test.start_time,
+ self._project_name, self._case_name, self.test.start_time,
self.test.stop_time, self.test.criteria, self.test.details)
@mock.patch('functest.utils.functest_utils.push_results_to_db',
@@ -92,7 +93,7 @@ class TestCaseTesting(unittest.TestCase):
self.assertEqual(self.test.push_to_db(),
testcase.TestCase.EX_OK)
mock_function.assert_called_once_with(
- self.test.project, self._case_name, self.test.start_time,
+ self._project_name, self._case_name, self.test.start_time,
self.test.stop_time, self.test.criteria, self.test.details)
def test_check_criteria_missing(self):
diff --git a/functest/tests/unit/features/test_barometer.py b/functest/tests/unit/features/test_barometer.py
index 62f2e0d6e..8ca463b24 100644
--- a/functest/tests/unit/features/test_barometer.py
+++ b/functest/tests/unit/features/test_barometer.py
@@ -19,36 +19,31 @@ from functest.core import testcase
sys.modules['baro_tests'] = mock.Mock() # noqa
# pylint: disable=wrong-import-position
from functest.opnfv_tests.features import barometer
-from functest.utils import constants
class BarometerTesting(unittest.TestCase):
logging.disable(logging.CRITICAL)
+ _case_name = "barometercollectd"
+ _project_name = "barometer"
+
def setUp(self):
self.barometer = barometer.BarometerCollectd(
- case_name="barometercollectd")
+ case_name=self._case_name, project_name=self._project_name)
def test_init(self):
- self.assertEqual(self.barometer.project_name, "barometer")
- self.assertEqual(self.barometer.case_name, "barometercollectd")
- self.assertEqual(
- self.barometer.repo,
- constants.CONST.__getattribute__('dir_repo_barometer'))
-
- @unittest.skip("JIRA: FUNCTEST-777")
- def test_execute_ko(self):
- # It must be skipped to allow merging
+ self.assertEqual(self.barometer.project_name, self._project_name)
+ self.assertEqual(self.barometer.case_name, self._case_name)
+
+ def test_run_ko(self):
sys.modules['baro_tests'].collectd.main = mock.Mock(return_value=1)
- self.assertEqual(self.barometer.execute(),
+ self.assertEqual(self.barometer.run(),
testcase.TestCase.EX_RUN_ERROR)
- @unittest.skip("JIRA: FUNCTEST-777")
- def test_execute(self):
- # It must be skipped to allow merging
+ def test_run(self):
sys.modules['baro_tests'].collectd.main = mock.Mock(return_value=0)
- self.assertEqual(self.barometer.execute(), testcase.TestCase.EX_OK)
+ self.assertEqual(self.barometer.run(), testcase.TestCase.EX_OK)
if __name__ == "__main__":
diff --git a/functest/tests/unit/features/test_copper.py b/functest/tests/unit/features/test_copper.py
index b6d187f7a..56bf41370 100644
--- a/functest/tests/unit/features/test_copper.py
+++ b/functest/tests/unit/features/test_copper.py
@@ -13,25 +13,26 @@ import logging
import unittest
from functest.opnfv_tests.features import copper
-from functest.utils import constants
+from functest.utils.constants import CONST
class CopperTesting(unittest.TestCase):
logging.disable(logging.CRITICAL)
+ _case_name = "copper-notification"
+ _project_name = "copper"
+
def setUp(self):
- self.copper = copper.Copper(case_name="copper-notification")
+ self.copper = copper.Copper(case_name=self._case_name,
+ project_name=self._project_name)
def test_init(self):
- self.assertEqual(self.copper.project_name, "copper")
- self.assertEqual(self.copper.case_name, "copper-notification")
- self.assertEqual(
- self.copper.repo,
- constants.CONST.__getattribute__("dir_repo_copper"))
+ self.assertEqual(self.copper.project_name, self._project_name)
+ repo = CONST.__getattribute__('dir_repo_copper')
self.assertEqual(
self.copper.cmd,
- "cd {}/tests && bash run.sh && cd -".format(self.copper.repo))
+ "cd {}/tests && bash run.sh && cd -".format(repo))
if __name__ == "__main__":
diff --git a/functest/tests/unit/features/test_doctor.py b/functest/tests/unit/features/test_doctor.py
index 36bac44f0..650d1509e 100644
--- a/functest/tests/unit/features/test_doctor.py
+++ b/functest/tests/unit/features/test_doctor.py
@@ -13,25 +13,27 @@ import logging
import unittest
from functest.opnfv_tests.features import doctor
-from functest.utils import constants
+from functest.utils.constants import CONST
class DoctorTesting(unittest.TestCase):
logging.disable(logging.CRITICAL)
+ _case_name = "doctor-notification"
+ _project_name = "doctor"
+
def setUp(self):
- self.doctor = doctor.Doctor(case_name="doctor-notification")
+ self.doctor = doctor.Doctor(case_name=self._case_name,
+ project_name=self._project_name)
def test_init(self):
- self.assertEqual(self.doctor.project_name, "doctor")
- self.assertEqual(self.doctor.case_name, "doctor-notification")
- self.assertEqual(
- self.doctor.repo,
- constants.CONST.__getattribute__("dir_repo_doctor"))
+ self.assertEqual(self.doctor.project_name, self._project_name)
+ self.assertEqual(self.doctor.case_name, self._case_name)
+ repo = CONST.__getattribute__('dir_repo_doctor')
self.assertEqual(
self.doctor.cmd,
- 'cd {}/tests && ./run.sh'.format(self.doctor.repo))
+ 'cd {}/tests && ./run.sh'.format(repo))
if __name__ == "__main__":
diff --git a/functest/tests/unit/features/test_domino.py b/functest/tests/unit/features/test_domino.py
index c0bfd14b4..f311af33d 100644
--- a/functest/tests/unit/features/test_domino.py
+++ b/functest/tests/unit/features/test_domino.py
@@ -13,25 +13,27 @@ import logging
import unittest
from functest.opnfv_tests.features import domino
-from functest.utils import constants
+from functest.utils.constants import CONST
class DominoTesting(unittest.TestCase):
logging.disable(logging.CRITICAL)
+ _case_name = "domino-multinode"
+ _project_name = "domino"
+
def setUp(self):
- self.domino = domino.Domino(case_name="domino-multinode")
+ self.domino = domino.Domino(case_name=self._case_name,
+ project_name=self._project_name)
def test_init(self):
- self.assertEqual(self.domino.project_name, "domino")
- self.assertEqual(self.domino.case_name, "domino-multinode")
- self.assertEqual(
- self.domino.repo,
- constants.CONST.__getattribute__("dir_repo_domino"))
+ self.assertEqual(self.domino.project_name, self._project_name)
+ self.assertEqual(self.domino.case_name, self._case_name)
+ repo = CONST.__getattribute__('dir_repo_domino')
self.assertEqual(
self.domino.cmd,
- 'cd {} && ./tests/run_multinode.sh'.format(self.domino.repo))
+ 'cd {} && ./tests/run_multinode.sh'.format(repo))
if __name__ == "__main__":
diff --git a/functest/tests/unit/features/test_netready.py b/functest/tests/unit/features/test_netready.py
index 47be42034..968401950 100644
--- a/functest/tests/unit/features/test_netready.py
+++ b/functest/tests/unit/features/test_netready.py
@@ -13,26 +13,27 @@ import logging
import unittest
from functest.opnfv_tests.features import netready
-from functest.utils import constants
+from functest.utils.constants import CONST
class NetreadyTesting(unittest.TestCase):
logging.disable(logging.CRITICAL)
+ _case_name = "gluon_vping"
+ _project_name = "netready"
+
def setUp(self):
- self.netready = netready.GluonVping(case_name="gluon_vping")
+ self.netready = netready.GluonVping(case_name=self._case_name,
+ project_name=self._project_name)
def test_init(self):
- self.assertEqual(self.netready.project_name, "netready")
- self.assertEqual(self.netready.case_name, "gluon_vping")
- self.assertEqual(
- self.netready.repo,
- constants.CONST.__getattribute__("dir_repo_netready"))
+ self.assertEqual(self.netready.project_name, self._project_name)
+ self.assertEqual(self.netready.case_name, self._case_name)
+ repo = CONST.__getattribute__('dir_repo_netready')
self.assertEqual(
self.netready.cmd,
- 'cd {}/test/functest && python ./gluon-test-suite.py'.format(
- self.netready.repo))
+ 'cd {}/test/functest && python ./gluon-test-suite.py'.format(repo))
if __name__ == "__main__":
diff --git a/functest/tests/unit/features/test_odl_sfc.py b/functest/tests/unit/features/test_odl_sfc.py
index dcdcdff63..5673e2b18 100644
--- a/functest/tests/unit/features/test_odl_sfc.py
+++ b/functest/tests/unit/features/test_odl_sfc.py
@@ -13,23 +13,26 @@ import logging
import unittest
from functest.opnfv_tests.features import odl_sfc
-from functest.utils import constants
+from functest.utils.constants import CONST
class OpenDaylightSFCTesting(unittest.TestCase):
logging.disable(logging.CRITICAL)
+ _case_name = "functest-odl-sfc"
+ _project_name = "sfc"
+
def setUp(self):
- self.odl_sfc = odl_sfc.OpenDaylightSFC(case_name="functest-odl-sfc")
+ self.odl_sfc = odl_sfc.OpenDaylightSFC(
+ case_name="functest-odl-sfc",
+ project_name=self._project_name)
def test_init(self):
self.assertEqual(self.odl_sfc.project_name, "sfc")
self.assertEqual(self.odl_sfc.case_name, "functest-odl-sfc")
- self.assertEqual(
- self.odl_sfc.repo,
- constants.CONST.__getattribute__("dir_repo_sfc"))
- dir_sfc_functest = '{}/sfc/tests/functest'.format(self.odl_sfc.repo)
+ repo = CONST.__getattribute__('dir_repo_sfc')
+ dir_sfc_functest = '{}/sfc/tests/functest'.format(repo)
self.assertEqual(
self.odl_sfc.cmd,
'cd {} && python ./run_tests.py'.format(dir_sfc_functest))
diff --git a/functest/tests/unit/features/test_promise.py b/functest/tests/unit/features/test_promise.py
index 29b4d4ec8..8fa1fba04 100644
--- a/functest/tests/unit/features/test_promise.py
+++ b/functest/tests/unit/features/test_promise.py
@@ -13,26 +13,28 @@ import logging
import unittest
from functest.opnfv_tests.features import promise
-from functest.utils import constants
+from functest.utils.constants import CONST
class PromiseTesting(unittest.TestCase):
logging.disable(logging.CRITICAL)
+ _case_name = "promise"
+ _project_name = "promise"
+
def setUp(self):
- self.promise = promise.Promise(case_name="promise")
+ self.promise = promise.Promise(case_name=self._case_name,
+ project_name=self._project_name)
def test_init(self):
- self.assertEqual(self.promise.project_name, "promise")
- self.assertEqual(self.promise.case_name, "promise")
- self.assertEqual(
- self.promise.repo,
- constants.CONST.__getattribute__("dir_repo_promise"))
+ self.assertEqual(self.promise.project_name, self._project_name)
+ self.assertEqual(self.promise.case_name, self._case_name)
+ repo = CONST.__getattribute__('dir_repo_promise')
self.assertEqual(
self.promise.cmd,
'cd {}/promise/test/functest && python ./run_tests.py'.format(
- self.promise.repo))
+ repo))
if __name__ == "__main__":
diff --git a/functest/tests/unit/features/test_sdnvpn.py b/functest/tests/unit/features/test_sdnvpn.py
index 8fa43fc44..75657fc41 100644
--- a/functest/tests/unit/features/test_sdnvpn.py
+++ b/functest/tests/unit/features/test_sdnvpn.py
@@ -13,26 +13,27 @@ import logging
import unittest
from functest.opnfv_tests.features import sdnvpn
-from functest.utils import constants
+from functest.utils.constants import CONST
class SdnVpnTesting(unittest.TestCase):
logging.disable(logging.CRITICAL)
+ _case_name = "bgpvpn"
+ _project_name = "sdnvpn"
+
def setUp(self):
- self.sdnvpn = sdnvpn.SdnVpnTests(case_name="bgpvpn")
+ self.sdnvpn = sdnvpn.SdnVpnTests(case_name=self._case_name,
+ project_name=self._project_name)
def test_init(self):
- self.assertEqual(self.sdnvpn.project_name, "sdnvpn")
- self.assertEqual(self.sdnvpn.case_name, "bgpvpn")
- self.assertEqual(
- self.sdnvpn.repo,
- constants.CONST.__getattribute__("dir_repo_sdnvpn"))
+ self.assertEqual(self.sdnvpn.project_name, self._project_name)
+ self.assertEqual(self.sdnvpn.case_name, self._case_name)
+ repo = CONST.__getattribute__('dir_repo_sdnvpn')
self.assertEqual(
self.sdnvpn.cmd,
- 'cd {}/sdnvpn/test/functest && python ./run_tests.py'.format(
- self.sdnvpn.repo))
+ 'cd {}/sdnvpn/test/functest && python ./run_tests.py'.format(repo))
if __name__ == "__main__":
diff --git a/functest/tests/unit/features/test_security_scan.py b/functest/tests/unit/features/test_security_scan.py
index f0e40159d..61ae9dc15 100644
--- a/functest/tests/unit/features/test_security_scan.py
+++ b/functest/tests/unit/features/test_security_scan.py
@@ -13,29 +13,31 @@ import logging
import unittest
from functest.opnfv_tests.features import security_scan
-from functest.utils import constants
+from functest.utils.constants import CONST
class SecurityScanTesting(unittest.TestCase):
logging.disable(logging.CRITICAL)
+ _case_name = "security_scan"
+ _project_name = "security_scan"
+
def setUp(self):
- self.sscan = security_scan.SecurityScan(case_name="security_scan")
+ self.sscan = security_scan.SecurityScan(
+ case_name=self._case_name, project_name=self._project_name)
def test_init(self):
- self.assertEqual(self.sscan.project_name, "securityscanning")
- self.assertEqual(self.sscan.case_name, "security_scan")
- self.assertEqual(
- self.sscan.repo,
- constants.CONST.__getattribute__("dir_repo_securityscan"))
+ self.assertEqual(self.sscan.project_name, self._project_name)
+ self.assertEqual(self.sscan.case_name, self._case_name)
+ repo = CONST.__getattribute__('dir_repo_securityscan')
self.assertEqual(
self.sscan.cmd, (
'. {0}/stackrc && cd {1} && '
'python security_scan.py --config config.ini && '
'cd -'.format(
- constants.CONST.__getattribute__("dir_functest_conf"),
- self.sscan.repo)))
+ CONST.__getattribute__("dir_functest_conf"),
+ repo)))
if __name__ == "__main__":
diff --git a/functest/tests/unit/odl/test_odl.py b/functest/tests/unit/odl/test_odl.py
index e08deb27d..55e100dd4 100644
--- a/functest/tests/unit/odl/test_odl.py
+++ b/functest/tests/unit/odl/test_odl.py
@@ -90,7 +90,7 @@ class ODLTesting(unittest.TestCase):
os.environ["OS_USERNAME"] = self._os_username
os.environ["OS_PASSWORD"] = self._os_password
os.environ["OS_TENANT_NAME"] = self._os_tenantname
- self.test = odl.ODLTests()
+ self.test = odl.ODLTests(case_name='odl', project_name='functest')
self.defaultargs = {'odlusername': self._odl_username,
'odlpassword': self._odl_password,
'neutronip': self._keystone_ip,
diff --git a/functest/tests/unit/opnfv_tests/vnf/ims/test_ims_base.by b/functest/tests/unit/opnfv_tests/vnf/ims/test_ims_base.py
index 9440bcdf3..e283199c3 100644
--- a/functest/tests/unit/opnfv_tests/vnf/ims/test_ims_base.by
+++ b/functest/tests/unit/opnfv_tests/vnf/ims/test_ims_base.py
@@ -10,7 +10,7 @@ import unittest
import mock
-from functest.opnfv_tests.vnf.ims import ims_base
+from functest.opnfv_tests.vnf.ims import clearwater_ims_base as ims_base
class ClearwaterOnBoardingBaseTesting(unittest.TestCase):
@@ -38,8 +38,8 @@ class ClearwaterOnBoardingBaseTesting(unittest.TestCase):
self.mock_post_200.configure_mock(**attrs)
def test_create_ellis_number_failure(self):
- with mock.patch('functest.opnfv_tests.vnf.ims.ims_base.'
- 'requests.post',
+ with mock.patch('functest.opnfv_tests.vnf.ims.'
+ 'clearwater_ims_base.requests.post',
return_value=self.mock_post_500), \
self.assertRaises(Exception) as context:
self.ims_vnf.create_ellis_number()
diff --git a/functest/tests/unit/utils/test_functest_utils.py b/functest/tests/unit/utils/test_functest_utils.py
index eb241e5d0..22cadf0f4 100644
--- a/functest/tests/unit/utils/test_functest_utils.py
+++ b/functest/tests/unit/utils/test_functest_utils.py
@@ -54,7 +54,8 @@ class FunctestUtilsTesting(unittest.TestCase):
self.cmd = 'test_cmd'
self.output_file = 'test_output_file'
self.testname = 'testname'
- self.testcase_dict = {'name': 'testname', 'criteria': self.criteria}
+ self.testcase_dict = {'case_name': 'testname',
+ 'criteria': self.criteria}
self.parameter = 'general.openstack.image_name'
self.config_yaml = 'test_config_yaml-'
self.db_url_env = 'http://foo/testdb'
diff --git a/functest/tests/unit/vnf/__init__.py b/functest/tests/unit/vnf/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/functest/tests/unit/vnf/__init__.py
diff --git a/functest/tests/unit/vnf/rnc/__init__.py b/functest/tests/unit/vnf/rnc/__init__.py
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/functest/tests/unit/vnf/rnc/__init__.py
diff --git a/functest/tests/unit/vnf/rnc/test_parser.py b/functest/tests/unit/vnf/rnc/test_parser.py
new file mode 100644
index 000000000..9e310ccee
--- /dev/null
+++ b/functest/tests/unit/vnf/rnc/test_parser.py
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2017 Orange and others.
+#
+# All rights reserved. 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
+
+# pylint: disable=missing-docstring
+
+import logging
+import unittest
+
+from functest.opnfv_tests.vnf.rnc import parser
+from functest.utils.constants import CONST
+
+
+class ParserTesting(unittest.TestCase):
+
+ logging.disable(logging.CRITICAL)
+
+ _case_name = "parser-basics"
+ _project_name = "parser"
+
+ def setUp(self):
+ self.parser = parser.Parser(
+ case_name=self._case_name, project_name=self._project_name)
+
+ def test_init(self):
+ self.assertEqual(self.parser.project_name, self._project_name)
+ self.assertEqual(self.parser.case_name, self._case_name)
+ repo = CONST.__getattribute__('dir_repo_parser')
+ self.assertEqual(
+ self.parser.cmd,
+ 'cd {}/tests && ./functest_run.sh'.format(repo))
+
+
+if __name__ == "__main__":
+ unittest.main(verbosity=2)
diff --git a/functest/utils/functest_utils.py b/functest/utils/functest_utils.py
index 7cc5029d9..ef9d3da94 100644
--- a/functest/utils/functest_utils.py
+++ b/functest/utils/functest_utils.py
@@ -337,7 +337,7 @@ def get_dict_by_test(testname):
for dic_tier in testcases_yaml.get("tiers"):
for dic_testcase in dic_tier['testcases']:
- if dic_testcase['name'] == testname:
+ if dic_testcase['case_name'] == testname:
return dic_testcase
logger.error('Project %s is not defined in testcases.yaml' % testname)
diff --git a/run_unit_tests.sh b/run_unit_tests.sh
index 917c8eee8..5a66dd7fa 100755
--- a/run_unit_tests.sh
+++ b/run_unit_tests.sh
@@ -43,6 +43,7 @@ nosetests --with-xunit \
--cover-package=functest.core \
--cover-package=functest.opnfv_tests.sdn.odl.odl \
--cover-package=functest.opnfv_tests.vnf.ims \
+ --cover-package=functest.opnfv_tests.vnf.rnc \
--cover-package=functest.utils \
--cover-package=functest.opnfv_tests.features \
--cover-package=functest.opnfv_tests.openstack \