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.
 
 
 

137 lines
4.9 KiB

#
#
# ----------------------------------------------------------
"""
This program is created for the business-test on the level of unit testing.
On this level there is an intensive test-set up to a carthesian product possible.
The test-specification is written in a yaml-config in the data-directory.
workflow:
1. generate test-cases with all inputs into a csv-file of the spec-yaml
2. run the csv-file and collect all results into a new result-csv-file with all inputs and outputs
3. check the result-csv-file and declare it as a target-results
OR instead 2 and 3 on test-first-strategy:
3. create manually the target-result with your inputs and the target system-outputs
4. run and compare the actual-result with the target-result
5. at the end you get an xls-sheet like your result-csv-file
but additionally with comparsion-result as detailed result and the only counts of passed and failed tests
as minimum-result which can be inserted into management-tools
"""
# Press the green button in the gutter to run the script.
import importlib
import os, glob
import io
import sys
import basic.program
import basic.constants as B
import tools.job_tool
import model.catalog
PROGRAM_NAME = "start_dialog"
VERIFY = False
def startPyJob(job):
# check if an actual job is stored
childArgs = tools.job_tool.read_child_args(job)
if childArgs is None:
childArgs = initDialog(job)
pass
def getChoice(job, choiselist, description):
"""
to choise one of the list or exit the program
:param job:
:param choiselist:
:param description:
:return:
"""
index = 0
print("+------------- "+description+" ----------")
print('| | {:2d} : {:60s}'.format(0, "exit"))
for k in choiselist:
index += 1
print('| | {:2d} : {:60s}'.format(index, k))
print("+-----------------------------------------------")
choice = input("Auswahl 1-" + str(index) + ": ")
if not choice.isnumeric():
print("FEHLER Fehleingabe "+choice)
getChoice(job, choiselist, description)
elif int(choice) < 1:
job.stopJob(0)
exit(0)
elif int(choice) > index:
print("FEHLER Fehleingabe "+choice)
getChoice(job, choiselist, description)
else:
return choiselist[int(choice) - 1]
def initDialog(job, args={}):
"""
dialog to initialize a child-process
:param job:
:return:
"""
# which process
if "proc" not in args:
args["proc"] = getChoice(job, tools.job_tool.LIST_PROC, "Welchen Prozess starten")
args["gran"] = ""
args[B.PAR_USER] = tools.job_tool.getUser()
args[B.PAR_PROJ] = tools.job_tool.getUserProject()
args[B.PAR_STEP] = ""
if args["proc"] == tools.job_tool.PROC_TP_EXECUTION:
args["gran"] = B.PAR_TESTPLAN
args[B.PAR_STEP] = "1"
args[B.PAR_PROGRAM] = tools.job_tool.PROG_TEST_EXECUTER
elif args["proc"] in [tools.job_tool.PROC_TS_STEPWISE, tools.job_tool.PROC_TS_EXECUTION]:
args["gran"] = B.PAR_TESTSUITE
args[B.PAR_STEP] = "1"
if args["proc"] == tools.job_tool.PROC_TS_EXECUTION:
args[B.PAR_PROGRAM] = tools.job_tool.PROG_TEST_EXECUTER
else:
args[B.PAR_PROGRAM] = tools.job_tool.PROG_TS_INIT
elif args["proc"] in [tools.job_tool.PROC_TC_STEPWISE, tools.job_tool.PROC_TC_EXECUTION]:
args["gran"] = B.PAR_TESTCASE
args[B.PAR_STEP] = "1"
if args["proc"] == tools.job_tool.PROC_TC_EXECUTION:
args[B.PAR_PROGRAM] = tools.job_tool.PROG_TEST_EXECUTER
else:
args[B.PAR_PROGRAM] = tools.job_tool.PROG_TC_INIT
elif args["proc"] == tools.job_tool.PROC_REDO_EXECUTION:
args[B.PAR_PROGRAM] = getChoice(job, tools.job_tool.LIST_TS_PROGS + tools.job_tool.LIST_TC_PROGS,
"Welches Programm starten")
elif args["proc"] == tools.job_tool.PROC_SINGLE_JOB:
args[B.PAR_PROGRAM] = getChoice(job, tools.job_tool.LIST_SERVICE_PROG, "Welches Programm starten")
else:
args["gran"] = ""
catalog = model.catalog.Catalog.getInstance()
programDef = catalog.getValue(job, basic.program.CTLG_NAME, args[B.PAR_PROGRAM], "")
for p in programDef[basic.program.CTLG_PARDEF]:
if p in args:
print("p "+p+" ist "+args[p])
else:
args[p] = programDef[basic.program.CTLG_PARDEF][p]
print("p "+p+" jetzt " + args[p])
print(str(args))
def childDialog(job, args):
"""
dialog to manage the child-process
:param job:
:return:
"""
pass
if __name__ == '__main__':
job = basic.program.Job(PROGRAM_NAME)
# TODO to move to job_tool
args = {}
if isinstance(job.programDef[basic.program.CTLG_PARDEF], dict):
for p in job.programDef[basic.program.CTLG_PARDEF]:
args[p] = job.programDef[basic.program.CTLG_PARDEF][p]
job.setParameter(args)
job.startJob()
startPyJob(job)
job.stopJob(0)