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]))
else:
setattr(self, tools.data_tool.getSingularKeyword(k), config[rootname][key])
if getattr(self, D.FIELD_NAME, "") == "":
setattr(self, D.FIELD_NAME, rootname)
for k in subjects:
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 = ""
project = ""
reference = ""
attribute = ""
attributes = ""
stories = {}
tables = {}
steps = {}

1
model/testsuite.py

@ -85,6 +85,7 @@ class Testsuite(model.entity.Entity):
:return:
"""
# 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))
#self.setAttributes(config, name, LIST_FIELDS, 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'}
res = tools.job_tool.select_variant(job, "", "Testfall", args)
print(str(res))
self.assertEqual(len(res), 1)
self.assertEqual("defaultVariant", res[0])
self.assertEqual(len(res), 3)
self.assertEqual("01_init_testcase", res[0])
args = {'proc': 'Testfall ausfuehren', 'gran': 'Testfall', 'user': 'ulrich',
'project': 'TESTPROJ', 'step': '1', 'program': 'test_executer',
'application': 'TESTAPP', 'environment': 'ENV01', 'testcase': 'TC0001'}
res = tools.job_tool.select_variant(job, "", "Testfall", args)
print(str(res))
self.assertEqual(len(res), 2)
self.assertEqual("xml-rest", res[0])
self.assertEqual(len(res), 3)
self.assertEqual("01_init_testcase", res[0])
def test_14selectTestplan(self):
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_TESTPLAN] = args[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))
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"):
setattr(childJob.par, "tool", getattr(job.par, "tool"))
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]:
setParameterArgs(job, args, [B.PAR_PROJ])
print("select ts spec " + gran)
out = model.testsuite.select_testsuite(job, args[B.PAR_PROJ], args[B.PAR_TESTSUITE])
if "variant" not in out:
return [""]
return list(out["variant"].keys())
testsuite = model.factory.getTestsuite(job, args[B.PAR_PROJ], name=args[B.PAR_TESTSUITE])
if hasattr(testsuite, B.SUBJECT_VARIANTS):
outVariants = list(getattr(testsuite, B.SUBJECT_VARIANTS).keys())
elif gran in [B.PAR_TESTCASE, J.GRAN_TC]:
setParameterArgs(job, args, [B.PAR_PROJ])
print("select tc spec " + gran + " " + str(args))
@ -293,6 +292,8 @@ def select_variant(job, programDef, gran, args):
# return [""]
if hasattr(testcase, B.SUBJECT_VARIANTS):
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())
else:
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):
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
def select_testcase(job, programDef, args):

Loading…
Cancel
Save