From 23c9ae8fa5db3ea02077d97452ea503097cf985e Mon Sep 17 00:00:00 2001 From: Panagiotis Karalis Date: Wed, 14 Feb 2018 15:28:02 +0200 Subject: Clean up Test Case code Too much of duplicated code has been obeserved in test cases. With this patch a small refactoring is necessery to our test cases code. So they can be more generic and more flexible. To achieve that the addition of new parent class is essential, hence all the rest test case classes will inherit from the aforementioned parent class. Change-Id: I6a50d8330a06321742b3bb03cc999682d4a4e6a1 Signed-off-by: Panagiotis Karalis --- sfc/tests/functest/run_sfc_tests.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'sfc/tests/functest/run_sfc_tests.py') diff --git a/sfc/tests/functest/run_sfc_tests.py b/sfc/tests/functest/run_sfc_tests.py index dba73b98..015255a6 100644 --- a/sfc/tests/functest/run_sfc_tests.py +++ b/sfc/tests/functest/run_sfc_tests.py @@ -149,12 +149,20 @@ class SfcFunctest(testcase.TestCase): (test_name, test_descr)) logger.info(title) logger.info("%s\n" % ("=" * len(title))) - t = importlib.import_module( + module = importlib.import_module( "sfc.tests.functest.{0}".format(test_name), package=None) + + testcase_config = sfc_config.TestcaseConfig(test_name) + supported_installers = test_cfg['supported_installers'] + vnf_names = test_cfg['vnf_names'] + + tc_class = getattr(module, test_cfg['class_name']) + tc_instance = tc_class(testcase_config, supported_installers, + vnf_names) start_time = time.time() try: - result, creators = t.main() + result, creators = tc_instance.run() except Exception as e: logger.error("Exception when executing: %s" % test_name) logger.error(e) -- cgit 1.2.3-korg