Data-Test-Executer Framework speziell zum Test von Datenverarbeitungen mit Datengenerierung, Systemvorbereitungen, Einspielungen, ganzheitlicher diversifizierender Vergleich
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

86 lines
3.6 KiB

from datetime import datetime
import basic.program
import basic.constants as B
import utils.tdata_tool
import init_testcase
import init_testsuite
import execute_testcase
import finish_testsuite
PROGRAM_NAME = "test_executer"
myjob = None
testcases = []
testinstances = {}
def getTime():
time = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
return time
def start(myjob):
myjob.m.setMsg("# # # # # start executer # # # # # ")
tdata = utils.tdata_tool.getTestdata()
job = basic.program.Job("unit")
testcases = getattr(myjob.par, B.PAR_TESTCASE)
if not hasattr(myjob.par, "step"):
raise Exception("Parameter step is missing")
for step in tdata[B.DATA_NODE_STEPS]:
if int(step["_nr"]) != int(getattr(myjob.par, "step")):
continue
for arg in step["args"]:
if arg == "start":
if "testsuite" in step["args"][arg]:
jobargs = {B.PAR_APP: myjob.par.application, B.PAR_ENV: myjob.par.environment,
B.PAR_TESTSUITE: myjob.par.usecase, B.PAR_TSTIME: utils.date_tool.getActdate(utils.date_tool.F_DIR)}
job.popInstance()
job = basic.program.Job("unit")
job.par.setParameterArgs(jobargs)
job.setProgram(step["args"][arg])
print("Job initialisiert "+job.program+" in Verzeichnis "+getattr(job.par, B.PAR_TSDIR))
myjob.m.logInfo("Job initialisiert "+job.program+" in Verzeichnis "+getattr(job.par, B.PAR_TSDIR))
dirname = getattr(job.par, B.PAR_TSDIR)
job.stopJob(1)
job.popInstance()
basic.program.Job.pushInstance(myjob)
print("ende")
job = myjob
if B.PAR_TESTCASE in step["args"][arg]:
if step["comp"] in testcases:
jobargs = {B.PAR_APP: myjob.par.application, B.PAR_ENV: myjob.par.environment,
B.PAR_TCDIR: testcases[step["comp"]] }
else:
jobargs = {B.PAR_APP: myjob.par.application, B.PAR_ENV: myjob.par.environment,
B.PAR_TESTCASE: step["comp"], B.PAR_TCTIME: utils.date_tool.getActdate(utils.date_tool.F_DIR)}
job.popInstance()
job = basic.program.Job("unit")
job.par.setParameterArgs(jobargs)
job.setProgram(step["args"][arg])
print("Job initialisiert "+job.program+" in Verzeichnis "+getattr(job.par, B.PAR_TCDIR))
myjob.m.logInfo("Job initialisiert "+job.program+" in Verzeichnis "+getattr(job.par, B.PAR_TCDIR))
dirname = getattr(job.par, B.PAR_TCDIR)
testcases[step["comp"]] = dirname
job.stopJob(1)
job.popInstance()
basic.program.Job.pushInstance(myjob)
print("ende")
job = myjob
if arg == "report": # testsuite
basic.program.Job.pushInstance(myjob)
pass
basic.program.Job.pushInstance(myjob)
setattr(myjob.par, "testcases", testcases)
# myjob.stopJob(1)
if __name__ == '__main__':
print(PROGRAM_NAME)
x = basic.program.Job(PROGRAM_NAME)
#m = message.Message(3)
#m.closeMessage()
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)
start(x)
x.stopJob()