diff options
author | Shwetha-H-Panduranga <shwetha@gluster.com> | 2011-12-06 14:11:13 +0530 |
---|---|---|
committer | Shwetha-H-Panduranga <shwetha@gluster.com> | 2011-12-06 14:11:13 +0530 |
commit | 18445ae1a94366c955cc7626fb8ec749dedcf73e (patch) | |
tree | af8b3a9db47f3a472aa4abae4629b517aa71885b /atfexecute.py | |
parent | 5b847067495a65c71c56ad477780ed57e9e0fb2f (diff) |
Adding New/Updated Automation Files
Diffstat (limited to 'atfexecute.py')
-rw-r--r-- | atfexecute.py | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/atfexecute.py b/atfexecute.py new file mode 100644 index 0000000..a60402b --- /dev/null +++ b/atfexecute.py @@ -0,0 +1,63 @@ +"""atfexecute +""" + +import os.path +import sys +import parser +from atfglobals import GlobalObj + +def _execute_testunit(testunit): + """ + *) Parse the testcaseslist file in the 'testunit' and select test cases + specified for testing 'glusterversion' + *) Call Main.py of 'testunit' to execute the testcases. + """ + return_status = 1 + testruninfo_obj = GlobalObj.getTestrunInfoObj() + atfdir = testruninfo_obj.getAtfDir() + testunit_abspath = atfdir + "/TestUnits/" + testunit + + testenvfile = testunit_abspath + "/testenv.cfg" + testcaseslistfile = testunit_abspath + "/testcaseslist" + + if not os.path.exists(testenvfile): + default_testenvfile = atfdir + "testenv.cfg" + if not os.path.exists(testenvfile): + print "Skipping TestUnit %s . TestEnv File Not Found" % testenvfile + return return_status + else: + testenvfile = default_testenvfile + + if not os.path.exists(testcaseslistfile): + print "Skipping TestUnit %s" % testunit + return return_status + else: + testcaseslist = [] + testcasespassed = None + testcasesfailed = None + totaltestcases = None + + testcaseslist = parser.parse_testcaseslist_file(testcaseslistfile) + if not testcaseslist: + print "Skipping TestUnit %s. No testcases to execute" % testunit + return return_status + else: + sys.path.append(testunit_abspath) + import Main + print "Executing TestUnit: %s" % testunit + print "-" * 50 + return_status = Main.main(testenvfile, *testcaseslist) + return return_status + +def execute(): + """ + *) Execute the TestsCases form TestUnits specified in TestRunInfo File + """ + testruninfo_obj = GlobalObj.getTestrunInfoObj() + testunits = testruninfo_obj.getTestUnits() + for testunit in testunits: + _execute_testunit(testunit) + + return 0 + +__all__ = ['execute'] |