Browse Source

Failure in unittests solved

refactor
Ulrich 1 year ago
parent
commit
4007e30052
  1. 1
      model/entity.py
  2. 2
      model/testcase.py
  3. 1
      model/testsuite.py
  4. 8
      test/test_10job.py
  5. 0
      test/xtest_xml.py
  6. 14
      tools/job_tool.py

1
model/entity.py

@ -322,7 +322,6 @@ class Entity:
setattr(self, tools.data_tool.getSingularKeyword(k), tools.data_tool.getValueStr(config[rootname][key])) setattr(self, tools.data_tool.getSingularKeyword(k), tools.data_tool.getValueStr(config[rootname][key]))
else: else:
setattr(self, tools.data_tool.getSingularKeyword(k), config[rootname][key]) setattr(self, tools.data_tool.getSingularKeyword(k), config[rootname][key])
if getattr(self, D.FIELD_NAME, "") == "":
setattr(self, D.FIELD_NAME, rootname) setattr(self, D.FIELD_NAME, rootname)
for k in subjects: for k in subjects:
if k in [B.DATA_NODE_DATA, B.DATA_NODE_HEADER, B.DATA_NODE_FIELDS, B.DATA_NODE_ROW]: if k in [B.DATA_NODE_DATA, B.DATA_NODE_HEADER, B.DATA_NODE_FIELDS, B.DATA_NODE_ROW]:

2
model/testcase.py

@ -73,7 +73,7 @@ class Testcase(model.entity.Entity):
description = "" description = ""
project = "" project = ""
reference = "" reference = ""
attribute = "" attributes = ""
stories = {} stories = {}
tables = {} tables = {}
steps = {} steps = {}

1
model/testsuite.py

@ -85,6 +85,7 @@ class Testsuite(model.entity.Entity):
:return: :return:
""" """
# r = tools.config_tool.select_config_path(job, P.KEY_TESTCASE, "TC0001") # r = tools.config_tool.select_config_path(job, P.KEY_TESTCASE, "TC0001")
setattr(self, FIELD_NAME, name)
config = self.getConfig(job, P.KEY_TESTSUITE, name, tools.config_tool.get_plain_filename(job, name)) config = self.getConfig(job, P.KEY_TESTSUITE, name, tools.config_tool.get_plain_filename(job, name))
#self.setAttributes(config, name, LIST_FIELDS, LIST_SUBTABLES) #self.setAttributes(config, name, LIST_FIELDS, LIST_SUBTABLES)
for k in LIST_SUBTABLES: for k in LIST_SUBTABLES:

8
test/test_10job.py

@ -118,15 +118,15 @@ class MyTestCase(unittest.TestCase):
'application': 'TESTAPP', 'environment': 'ENV01', 'testcase': 'TC0002'} 'application': 'TESTAPP', 'environment': 'ENV01', 'testcase': 'TC0002'}
res = tools.job_tool.select_variant(job, "", "Testfall", args) res = tools.job_tool.select_variant(job, "", "Testfall", args)
print(str(res)) print(str(res))
self.assertEqual(len(res), 1) self.assertEqual(len(res), 3)
self.assertEqual("defaultVariant", res[0]) self.assertEqual("01_init_testcase", res[0])
args = {'proc': 'Testfall ausfuehren', 'gran': 'Testfall', 'user': 'ulrich', args = {'proc': 'Testfall ausfuehren', 'gran': 'Testfall', 'user': 'ulrich',
'project': 'TESTPROJ', 'step': '1', 'program': 'test_executer', 'project': 'TESTPROJ', 'step': '1', 'program': 'test_executer',
'application': 'TESTAPP', 'environment': 'ENV01', 'testcase': 'TC0001'} 'application': 'TESTAPP', 'environment': 'ENV01', 'testcase': 'TC0001'}
res = tools.job_tool.select_variant(job, "", "Testfall", args) res = tools.job_tool.select_variant(job, "", "Testfall", args)
print(str(res)) print(str(res))
self.assertEqual(len(res), 2) self.assertEqual(len(res), 3)
self.assertEqual("xml-rest", res[0]) self.assertEqual("01_init_testcase", res[0])
def test_14selectTestplan(self): def test_14selectTestplan(self):
global mymsg global mymsg

0
test/test_xml.py → test/xtest_xml.py

14
tools/job_tool.py

@ -128,9 +128,9 @@ def start_child_process(job, args):
childArgs[B.PAR_TPTIME] = date_tool.getActdate(date_tool.F_LOG) childArgs[B.PAR_TPTIME] = date_tool.getActdate(date_tool.F_LOG)
childArgs[B.PAR_TESTPLAN] = args[B.PAR_TESTPLAN] childArgs[B.PAR_TESTPLAN] = args[B.PAR_TESTPLAN]
childArgs[B.PAR_GRAN] = B.PAR_TESTPLAN childArgs[B.PAR_GRAN] = B.PAR_TESTPLAN
print("process-programm " + args[B.PAR_PROGRAM] + " :: " + str(childArgs))
job.m.logInfo("process-programm " + args[B.PAR_PROGRAM] + " :: " + str(childArgs)) job.m.logInfo("process-programm " + args[B.PAR_PROGRAM] + " :: " + str(childArgs))
childJob = basic.program.Job(args[B.PAR_PROGRAM], "ulrichX", childArgs) childJob = basic.program.Job(args[B.PAR_PROGRAM], "ulrich", childArgs)
if hasattr(job.par, "tool"): if hasattr(job.par, "tool"):
setattr(childJob.par, "tool", getattr(job.par, "tool")) setattr(childJob.par, "tool", getattr(job.par, "tool"))
childJob.m.logDebug(verifiy, "start_child_process "+childJob.program) childJob.m.logDebug(verifiy, "start_child_process "+childJob.program)
@ -280,10 +280,9 @@ def select_variant(job, programDef, gran, args):
elif gran in [B.PAR_TESTSUITE, J.GRAN_TS]: elif gran in [B.PAR_TESTSUITE, J.GRAN_TS]:
setParameterArgs(job, args, [B.PAR_PROJ]) setParameterArgs(job, args, [B.PAR_PROJ])
print("select ts spec " + gran) print("select ts spec " + gran)
out = model.testsuite.select_testsuite(job, args[B.PAR_PROJ], args[B.PAR_TESTSUITE]) testsuite = model.factory.getTestsuite(job, args[B.PAR_PROJ], name=args[B.PAR_TESTSUITE])
if "variant" not in out: if hasattr(testsuite, B.SUBJECT_VARIANTS):
return [""] outVariants = list(getattr(testsuite, B.SUBJECT_VARIANTS).keys())
return list(out["variant"].keys())
elif gran in [B.PAR_TESTCASE, J.GRAN_TC]: elif gran in [B.PAR_TESTCASE, J.GRAN_TC]:
setParameterArgs(job, args, [B.PAR_PROJ]) setParameterArgs(job, args, [B.PAR_PROJ])
print("select tc spec " + gran + " " + str(args)) print("select tc spec " + gran + " " + str(args))
@ -293,6 +292,8 @@ def select_variant(job, programDef, gran, args):
# return [""] # return [""]
if hasattr(testcase, B.SUBJECT_VARIANTS): if hasattr(testcase, B.SUBJECT_VARIANTS):
outVariants = list(getattr(testcase, B.SUBJECT_VARIANTS).keys()) outVariants = list(getattr(testcase, B.SUBJECT_VARIANTS).keys())
elif hasattr(testcase, B.SUBJECT_STEPS):
outVariants = list(getattr(testcase, B.SUBJECT_STEPS).keys())
#return list(testcase[B.SUBJECT_VARIANTS].keys()) #return list(testcase[B.SUBJECT_VARIANTS].keys())
else: else:
raise Exception("for gran "+gran+" variant can not be selected") raise Exception("for gran "+gran+" variant can not be selected")
@ -307,6 +308,7 @@ def select_testplan(job, programDef, args):
def select_testsuite(job, programDef, args): def select_testsuite(job, programDef, args):
outList = [] outList = []
outList = model.factory.getTestsuite(job, args[B.PAR_PROJ]).get_unique_names(job, project=args[B.PAR_PROJ], application=args[B.PAR_APP])
return outList return outList
def select_testcase(job, programDef, args): def select_testcase(job, programDef, args):

Loading…
Cancel
Save