From 77c7f324610224e808d8940aec7e6dbf19b790a5 Mon Sep 17 00:00:00 2001 From: Shwetha-H-Panduranga Date: Tue, 6 Dec 2011 14:26:59 +0530 Subject: Adding New/Updated Automation Files --- atfexecute.py | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 atfexecute.py (limited to 'atfexecute.py') 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'] -- cgit