Define how to pass args to TestcaseBase.run
authorCédric Ollivier <cedric.ollivier@orange.com>
Thu, 2 Feb 2017 08:19:03 +0000 (09:19 +0100)
committerCédric Ollivier <cedric.ollivier@orange.com>
Thu, 2 Feb 2017 08:21:13 +0000 (09:21 +0100)
Here is an exemple of functest/ci/testcases.yaml
run:
    module: 'functest.opnfv_tests.sdn.odl.odl'
    class: 'ODLTests'
    args:
        suites:
            -  /home/opnfv/repos/odl_test/csit/suites/integration/basic
            -  /home/opnfv/repos/odl_test/csit/suites/openstack/neutron

Change-Id: I37b0ffa18f626bd8bb52ed460ae38053bd12c8ee
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
functest/ci/run_tests.py

index ef08001..320102d 100755 (executable)
@@ -148,7 +148,11 @@ def run_test(test, tier_name, testcases=None):
             module = importlib.import_module(run_dict['module'])
             cls = getattr(module, run_dict['class'])
             test_case = cls()
-            result = test_case.run()
+            try:
+                kwargs = run_dict['args']
+                result = test_case.run(**kwargs)
+            except KeyError:
+                result = test_case.run()
             if result == testcase_base.TestcaseBase.EX_OK:
                 if GlobalVariables.REPORT_FLAG:
                     test_case.publish_report()