From 8918d1e511077b477bcef96b5b556ef7de76adff Mon Sep 17 00:00:00 2001 From: Ulrich Carmesin Date: Wed, 6 Apr 2022 17:00:18 +0200 Subject: [PATCH] mainprograms added --- compare_testcase.py | 46 ++++++++++++++++++++++ execute_testcase.py | 50 ++++++++++++++++++++++++ finish_testset.py => finish_testsuite.py | 0 3 files changed, 96 insertions(+) create mode 100644 compare_testcase.py create mode 100644 execute_testcase.py rename finish_testset.py => finish_testsuite.py (100%) diff --git a/compare_testcase.py b/compare_testcase.py new file mode 100644 index 0000000..7c4e5d1 --- /dev/null +++ b/compare_testcase.py @@ -0,0 +1,46 @@ +# This is a sample Python script. +import sys# +# import jsonpickle # pip install jsonpickle +import yaml # pip install pyyaml +import basic.program as program +import utils.tdata_tool +from basic.componentHandling import ComponentManager +import basic.message as message +# Press Umschalt+F10 to execute it or replace it with your code. +# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. + + +PROGRAM_NAME = "init_testcase" + +def start(job): + cm = ComponentManager() + print("cm "+str(cm)) + cm.initComponents() + comps = cm.getComponents(PROGRAM_NAME) + job.m.setMsg("# Components initialized with these relevant components " + str(comps)) + testdata = utils.tdata_tool.getTestdata() + for c in comps: + comp = cm.getComponent(c) + comp.m.logInfo("------- "+comp.name+" ----------------------------------------") + comp.reset_TData("testcase") + comp.load_TData("testcase", testdata) + comp.read_TData("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.logInfo("hier eine LogInfo") + x.m.logDebug("hier eine DbugMeldung") + 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() +# See PyCharm help at https://www.jetbrains.com/help/pycharm/ diff --git a/execute_testcase.py b/execute_testcase.py new file mode 100644 index 0000000..e38726f --- /dev/null +++ b/execute_testcase.py @@ -0,0 +1,50 @@ +# This is a sample Python script. +import sys# +import os +import basic.program as program +import utils.tdata_tool +import utils.report_tool +import utils.path_tool +import utils.file_tool +import basic.componentHandling +import basic.message as message +# Press Umschalt+F10 to execute it or replace it with your code. +# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. + + +PROGRAM_NAME = "compare_testcase" + +def startPyJob(job): + cm = basic.componentHandling.ComponentManager() + print("cm "+str(cm)) + cm.initComponents() + comps = cm.getComponents(PROGRAM_NAME) + job.m.setMsg("# Components initialized with these relevant components " + str(comps)) + report = utils.report_tool.Report() + testdata = utils.tdata_tool.getTestdata() + for c in comps: + comp = cm.getComponent(c) + comp.m.logInfo("------- "+comp.name+" ----------------------------------------") + comp.compare_TcResults(report) + comp.m.logInfo("------- "+comp.name+" ----------------------------------------") + job.m.merge(comp.m) + print(str(comp)) + comp.conf["function"][PROGRAM_NAME] = comp.m.topmessage + text = report.reportTestcase(job.par.testcase) + path = os.path.join(job.par.tcdir, "Result.html") + utils.file_tool.writeFileText(job.m, path, text) + +# 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.logInfo("hier eine LogInfo") + x.m.logDebug("hier eine DbugMeldung") + 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/ diff --git a/finish_testset.py b/finish_testsuite.py similarity index 100% rename from finish_testset.py rename to finish_testsuite.py