|
@ -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 |
|
|
read the testobjects of the granularity,project and select one of them with the time |
|
|
:return: |
|
|
:return: |
|
|
""" |
|
|
""" |
|
|
|
|
|
outVariants = [] |
|
|
print("select spec "+gran) |
|
|
print("select spec "+gran) |
|
|
if gran == J.GRAN_TP.lower(): |
|
|
if gran == J.GRAN_TP.lower(): |
|
|
|
|
|
setParameterArgs(job, args, [B.PAR_PROJ]) |
|
|
print("select tp spec " + gran) |
|
|
print("select tp spec " + gran) |
|
|
return [""] |
|
|
return [""] |
|
|
elif gran in [B.PAR_TESTSUITE, J.GRAN_TS]: |
|
|
elif gran in [B.PAR_TESTSUITE, J.GRAN_TS]: |
|
|
|
|
|
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]) |
|
|
out = model.testsuite.select_testsuite(job, args[B.PAR_PROJ], args[B.PAR_TESTSUITE]) |
|
|
if "variant" not in out: |
|
|
if "variant" not in out: |
|
|
return [""] |
|
|
return [""] |
|
|
return list(out["variant"].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]) |
|
|
print("select tc spec " + gran + " " + str(args)) |
|
|
print("select tc spec " + gran + " " + str(args)) |
|
|
out = model.factory.getTestcase(job, args[B.PAR_PROJ]).read_entity(job, args[B.PAR_TESTCASE]) |
|
|
testcase = model.factory.getTestcase(job, args[B.PAR_PROJ]).read_entity(job, args[B.PAR_TESTCASE]) |
|
|
print(str(out)) |
|
|
print(str(testcase)) |
|
|
if "variant" not in out: |
|
|
#if "variant" not in testcase: |
|
|
return [""] |
|
|
# return [""] |
|
|
return list(out["variant"].keys()) |
|
|
if hasattr(testcase, B.SUBJECT_VARIANTS): |
|
|
|
|
|
outVariants = list(getattr(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") |
|
|
|
|
|
if len(outVariants) == 0: |
|
|
|
|
|
outVariants.append("defaultVariant") |
|
|
print("select no spec "+gran) |
|
|
print("select no spec "+gran) |
|
|
|
|
|
return outVariants |
|
|
|
|
|
|
|
|
def select_testplan(job, programDef, args): |
|
|
def select_testplan(job, programDef, args): |
|
|
outList = [] |
|
|
outList = [] |
|
@ -298,4 +307,14 @@ def select_testcase(job, programDef, args): |
|
|
print("testcase args "+str(args)) |
|
|
print("testcase args "+str(args)) |
|
|
# outList = model.testcase.select_testcases(job, [args[B.PAR_PROJ]], [args[B.PAR_APP]]) |
|
|
# 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]) |
|
|
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 |
|
|
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]) |