#!/usr/bin/python # program to execute steps of a testcase # PARAM: --environment --application --tcdir [ testcase, tctime ] # main functions # + reset_testcase() : comp-config --> system # + load_testcase() : testspec --> tdata --> system.data # + select_testcase() : system.data --> data --> archiv.result # ---------------------------------------------------import os import basic.program as program import utils.tdata_tool import basic.componentHandling import basic.constants as B import utils.file_tool import utils.path_tool import utils.path_const as P import basic.message as message PROGRAM_NAME = "init_testcase" def startPyJob(job): cm = basic.componentHandling.ComponentManager.getInstance(job, "init") cm.initComponents() comps = cm.getComponents(PROGRAM_NAME) job.m.setMsg("# Components initialized with these relevant components " + str(comps)) testdata = utils.tdata_tool.getTestdata(job) print("------------------------------------------------------------") for c in comps: comp = cm.getComponent(c) comp.m.logInfo("------- "+comp.name+" ----------------------------------------") if job.hasFunction("reset_TData"): comp.reset_TData(job, B.PAR_TESTCASE) if job.hasFunction("load_TData"): comp.load_TData(job, B.PAR_TESTCASE, testdata) if job.hasFunction("read_TData"): comp.read_TData(job, utils.path_tool.getKeyValue(P.KEY_PRECOND), B.PAR_TESTCASE) comp.m.logInfo("------- "+comp.name+" ----------------------------------------") job.m.merge(comp.m) print(str(comp)) comp.conf["function"][PROGRAM_NAME] = comp.m.topmessage # Press the green button in the gutter to run the script. if __name__ == '__main__': print(PROGRAM_NAME) x = program.Job(PROGRAM_NAME) x.startJob() x.m.logDebug(str(vars(x.par)) + "\n" + str(vars(x.conf))) if x.m.isRc("fatal"): x.stopJob() exit(x.m.rc * (-1) + 3) startPyJob(x) x.stopJob() # See PyCharm help at https://www.jetbrains.com/help/pycharm/