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.

62 lines
2.3 KiB

#!/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
2 years ago
import traceback
3 years ago
import basic.program as program
3 years ago
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
3 years ago
import basic.message as message
3 years ago
3 years ago
PROGRAM_NAME = "init_testcase"
3 years ago
def startPyJob(job):
cm = basic.componentHandling.ComponentManager.getInstance(job)
3 years ago
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("------------------------------------------------------------")
3 years ago
for c in comps:
comp = cm.getComponent(c)
comp.m.logInfo("------- "+comp.name+" ----------------------------------------")
2 years ago
try:
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(job, P.KEY_PRECOND), B.PAR_TESTCASE)
except Exception as e:
txt = traceback.format_exc()
job.m.setFatal("Exception "+str(e)+"\n"+txt)
print("Exception " + str(e)+"\n"+txt)
job.stopJob(0)
3 years ago
comp.m.logInfo("------- "+comp.name+" ----------------------------------------")
job.m.merge(comp.m)
3 years ago
print(str(comp))
comp.conf["function"][PROGRAM_NAME] = comp.m.topmessage
3 years ago
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
3 years ago
print(PROGRAM_NAME)
x = program.Job(PROGRAM_NAME)
3 years ago
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)
3 years ago
x.stopJob()
# See PyCharm help at https://www.jetbrains.com/help/pycharm/