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.
 
 
 

75 lines
2.8 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 unittest
import test.constants
import os, glob
import io
import sys
import test.constants as T
import basic.program
PROGRAM_NAME = "unit_tester"
VERIFY = False
class MyTestLoader(unittest.TestLoader):
def start_testcases(self):
pass
def create_test_suite(job):
suite = unittest.TestSuite()
for testdir in [T.PROG_PATH, T.COMP_PATH]:
testFileStrings = sorted(glob.glob(os.path.join(testdir, "test", 'test_*.py')))
for t in testFileStrings:
testnum = t[len(testdir)+11:len(testdir)+13]
if not testnum.isnumeric():
continue
if testnum not in ["01", "03", "07", "08", "10", "11", "14", "15", "16", "17", "19",
"20", "21", "22", "26", "27", "28", "29" ]:
continue
if testdir == T.COMP_PATH:
v = "components.test." + t[len(testdir) + 6:-3]
else:
v = "test."+t[len(testdir)+6:-3]
cmodul = importlib.import_module(v)
class_ = getattr(cmodul, "MyTestCase")
c = class_()
for f in cmodul.TEST_FUNCTIONS:
setattr(c, "verbose", False)
suite.addTest(class_(f))
return suite
def startPyJob(job):
suite = create_test_suite(job)
runner = unittest.TextTestRunner(sys.stdout, True, 3, True, True)
runner.run(suite)
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)