|
|
@ -264,26 +264,35 @@ def select_variant(job, programDef, gran, args): |
|
|
|
read the testobjects of the granularity,project and select one of them with the time |
|
|
|
:return: |
|
|
|
""" |
|
|
|
outVariants = [] |
|
|
|
print("select spec "+gran) |
|
|
|
if gran == J.GRAN_TP.lower(): |
|
|
|
setParameterArgs(job, args, [B.PAR_PROJ]) |
|
|
|
print("select tp spec " + gran) |
|
|
|
return [""] |
|
|
|
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()) |
|
|
|
elif gran in [B.PAR_TESTCASE, J.GRAN_TC]: |
|
|
|
setParameterArgs(job, args, [B.PAR_PROJ]) |
|
|
|
print("select tc spec " + gran + " " + str(args)) |
|
|
|
out = model.factory.getTestcase(job, args[B.PAR_PROJ]).read_entity(job, args[B.PAR_TESTCASE]) |
|
|
|
print(str(out)) |
|
|
|
if "variant" not in out: |
|
|
|
return [""] |
|
|
|
return list(out["variant"].keys()) |
|
|
|
testcase = model.factory.getTestcase(job, args[B.PAR_PROJ]).read_entity(job, args[B.PAR_TESTCASE]) |
|
|
|
print(str(testcase)) |
|
|
|
#if "variant" not in testcase: |
|
|
|
# return [""] |
|
|
|
if hasattr(testcase, B.SUBJECT_VARIANTS): |
|
|
|
outVariants = list(getattr(testcase, B.SUBJECT_VARIANTS).keys()) |
|
|
|
#return list(testcase[B.SUBJECT_VARIANTS].keys()) |
|
|
|
else: |
|
|
|
raise Exception("for gran "+gran+" variant can not be selected") |
|
|
|
if len(outVariants) == 0: |
|
|
|
outVariants.append("defaultVariant") |
|
|
|
print("select no spec "+gran) |
|
|
|
return outVariants |
|
|
|
|
|
|
|
def select_testplan(job, programDef, args): |
|
|
|
outList = [] |
|
|
@ -299,3 +308,13 @@ def select_testcase(job, programDef, args): |
|
|
|
# outList = model.testcase.select_testcases(job, [args[B.PAR_PROJ]], [args[B.PAR_APP]]) |
|
|
|
outList = model.factory.getTestcase(job, args[B.PAR_PROJ]).get_unique_names(job, project=args[B.PAR_PROJ], application=args[B.PAR_APP]) |
|
|
|
return outList |
|
|
|
|
|
|
|
def setParameterArgs(job, args, parameter): |
|
|
|
if not hasattr(job, "par"): |
|
|
|
job.setParameter({}) |
|
|
|
# setattr(job, "par", object) |
|
|
|
for p in parameter: |
|
|
|
if hasattr(job.par, p): |
|
|
|
continue |
|
|
|
if p in args: |
|
|
|
setattr(job.par, p, args[p]) |