|
@ -21,10 +21,16 @@ |
|
|
""" |
|
|
""" |
|
|
import getpass |
|
|
import getpass |
|
|
import os.path |
|
|
import os.path |
|
|
|
|
|
import pprint |
|
|
import sys |
|
|
import sys |
|
|
|
|
|
import json |
|
|
import basic.program |
|
|
import basic.program |
|
|
import basic.constants as B |
|
|
import basic.constants as B |
|
|
|
|
|
import check_environment |
|
|
|
|
|
import check_specification |
|
|
|
|
|
import check_configuration |
|
|
|
|
|
import tools.job_const as J |
|
|
|
|
|
|
|
|
try: |
|
|
try: |
|
|
import collect_testcase |
|
|
import collect_testcase |
|
|
import compare_testcase |
|
|
import compare_testcase |
|
@ -37,45 +43,13 @@ except Exception as e: |
|
|
pass |
|
|
pass |
|
|
import tools.path_tool |
|
|
import tools.path_tool |
|
|
import tools.file_tool |
|
|
import tools.file_tool |
|
|
|
|
|
import tools.date_tool as date_tool |
|
|
import components.tools.job_tool |
|
|
import components.tools.job_tool |
|
|
|
|
|
import model.application |
|
|
PROG_TC_INIT = "init_testcase" |
|
|
import model.environment |
|
|
PROG_TC_EXECUTE = "execute_testcase" |
|
|
import model.testplan |
|
|
PROG_TC_COLLECT = "collect_testcase" |
|
|
import model.testsuite |
|
|
PROG_TC_COMPARE = "compare_testcase" |
|
|
import model.testcase |
|
|
PROG_TS_INIT = "init_testsuite" |
|
|
|
|
|
PROG_TS_EXECUTE = "execute_testsuite" |
|
|
|
|
|
PROG_TS_COLLECT = "collect_testsuite" |
|
|
|
|
|
PROG_TS_FINISH = "finish_testsuite" |
|
|
|
|
|
PROG_TEST_EXECUTER = "test_executer" |
|
|
|
|
|
LIST_TC_PROGS = [PROG_TC_INIT, PROG_TC_EXECUTE, PROG_TC_COLLECT, PROG_TC_COMPARE] |
|
|
|
|
|
LIST_TS_PROGS = [PROG_TS_INIT, PROG_TS_EXECUTE, PROG_TS_COLLECT, PROG_TS_FINISH] |
|
|
|
|
|
|
|
|
|
|
|
PROG_CHECK_ENV = "check_environment" |
|
|
|
|
|
PROG_CHECK_CONF = "check_configuration" |
|
|
|
|
|
PROG_CHECK_SPEC = "check_specification" |
|
|
|
|
|
PROG_UNZIP_RESULT = "unzip_result" |
|
|
|
|
|
PROG_DECLARE_RESULT = "declare_result" |
|
|
|
|
|
PROG_CLEAN_WORKSPACE = "clean_workspace" |
|
|
|
|
|
PROG_MAKE_WORKSPACE = "make_workspace" |
|
|
|
|
|
PROG_UNIT_TESTER = "unit_tester" |
|
|
|
|
|
LIST_SERVICE_PROG = [PROG_CHECK_ENV, PROG_CHECK_CONF, PROG_CHECK_SPEC, PROG_UNZIP_RESULT, PROG_DECLARE_RESULT, |
|
|
|
|
|
PROG_CLEAN_WORKSPACE, PROG_MAKE_WORKSPACE, PROG_UNIT_TESTER] |
|
|
|
|
|
|
|
|
|
|
|
PROC_TP_EXECUTION = "Testplan ausfuehren" |
|
|
|
|
|
PROC_TS_EXECUTION = "Testsuite ausfuehren" |
|
|
|
|
|
PROC_TS_STEPWISE = "Testsuite Job fuer Job ausfuehren" |
|
|
|
|
|
PROC_TC_EXECUTION = "Testfall ausfuehren" |
|
|
|
|
|
PROC_TC_STEPWISE = "Testfall Job fuer Job ausfuehren" |
|
|
|
|
|
PROC_REDO_EXECUTION = "Job der Testausfuehrung wiederholen" |
|
|
|
|
|
PROC_SINGLE_JOB = "Einzelnes Programm ausfuehren" |
|
|
|
|
|
LIST_PROC = [PROC_TP_EXECUTION, PROC_TS_EXECUTION, PROC_TS_STEPWISE, PROC_TC_EXECUTION, PROC_TC_STEPWISE, |
|
|
|
|
|
PROC_REDO_EXECUTION, PROC_SINGLE_JOB] |
|
|
|
|
|
|
|
|
|
|
|
GRAN_TP = "Testplan" |
|
|
|
|
|
GRAN_TS = "Testsuite" |
|
|
|
|
|
GRAN_TC = "Testfall" |
|
|
|
|
|
LIST_GRAN = [GRAN_TP, GRAN_TS, GRAN_TC] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def hasModul(komp): |
|
|
def hasModul(komp): |
|
@ -109,7 +83,7 @@ def getUser(job=None): |
|
|
|
|
|
|
|
|
def getUserProject(job=None): |
|
|
def getUserProject(job=None): |
|
|
# TODO move to objects.user |
|
|
# TODO move to objects.user |
|
|
return "xxx" |
|
|
return "TESTPROJ" |
|
|
|
|
|
|
|
|
def getActChildPath(job): |
|
|
def getActChildPath(job): |
|
|
return os.path.join(job.conf[B.SUBJECT_PATH][B.ATTR_PATH_DEBUG], job.username+".json") |
|
|
return os.path.join(job.conf[B.SUBJECT_PATH][B.ATTR_PATH_DEBUG], job.username+".json") |
|
@ -134,23 +108,39 @@ def start_child_process(job, args): |
|
|
:param args: job-args |
|
|
:param args: job-args |
|
|
:return: |
|
|
:return: |
|
|
""" |
|
|
""" |
|
|
|
|
|
verifiy = job.getDebugLevel("job_tool") |
|
|
|
|
|
job.m.logDebug(verifiy, "start_child_process") |
|
|
|
|
|
job.m.logTrace(verifiy, args) |
|
|
print(str(args)) |
|
|
print(str(args)) |
|
|
path = tools.path_tool.getActualJsonPath(job) |
|
|
path = tools.path_tool.getActualJsonPath(job) |
|
|
print("------- "+path) |
|
|
|
|
|
tools.file_tool.writeFileDict(job.m, job, path, args) |
|
|
tools.file_tool.writeFileDict(job.m, job, path, args) |
|
|
childArgs = {} |
|
|
childArgs = {} |
|
|
childArgs[B.PAR_APP] = args[B.PAR_APP] |
|
|
for p in args: |
|
|
childArgs[B.PAR_ENV] = args[B.PAR_ENV] |
|
|
if p in B.LIST_MAIN_PAR: |
|
|
if B.PAR_STEP in args: |
|
|
childArgs[p] = args[p] |
|
|
childArgs[B.PAR_STEP] = args[B.PAR_STEP] |
|
|
if p in [B.PAR_USER]: |
|
|
if B.PAR_TCDIR in args: |
|
|
childArgs[p] = args[p] |
|
|
childArgs[B.PAR_TCDIR] = args[B.PAR_TCDIR] |
|
|
if p in [B.PAR_TESTCASE, B.PAR_TCTIME]: |
|
|
childArgs[B.PAR_TESTCASE] = args["entity"] |
|
|
childArgs[B.PAR_TCTIME] = date_tool.getActdate(date_tool.F_LOG) |
|
|
elif B.PAR_TSDIR in args: |
|
|
childArgs[B.PAR_TESTCASE] = args[B.PAR_TESTCASE] |
|
|
childArgs[B.PAR_TSDIR] = args[B.PAR_TSDIR] |
|
|
childArgs[B.PAR_GRAN] = B.PAR_TESTCASE |
|
|
childArgs[B.PAR_TESTSUITE] = args["entity"] |
|
|
elif p in [B.PAR_TESTSUITE, B.PAR_TSTIME]: |
|
|
print("process-programm " + args[B.PAR_PROGRAM]) |
|
|
childArgs[B.PAR_TSTIME] = date_tool.getActdate(date_tool.F_LOG) |
|
|
childJob = basic.program.Job(args[B.PAR_PROGRAM], childArgs) |
|
|
childArgs[B.PAR_TESTSUITE] = args[B.PAR_TESTSUITE] |
|
|
|
|
|
childArgs[B.PAR_GRAN] = B.PAR_TESTSUITE |
|
|
|
|
|
elif p in [B.PAR_TESTPLAN]: |
|
|
|
|
|
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 |
|
|
|
|
|
|
|
|
|
|
|
job.m.logInfo("process-programm " + args[B.PAR_PROGRAM] + " :: " + str(childArgs)) |
|
|
|
|
|
childJob = basic.program.Job(args[B.PAR_PROGRAM], "ulrichX", childArgs) |
|
|
|
|
|
if hasattr(job.par, "tool"): |
|
|
|
|
|
setattr(childJob.par, "tool", getattr(job.par, "tool")) |
|
|
|
|
|
childJob.m.logDebug(verifiy, "start_child_process "+childJob.program) |
|
|
|
|
|
childJob.m.logDebug(verifiy, args) |
|
|
|
|
|
childJob.m.logDebug(verifiy, B.LIST_MAIN_PAR) |
|
|
|
|
|
childJob.m.logDebug(verifiy, childArgs) |
|
|
childJob.startJob() |
|
|
childJob.startJob() |
|
|
if args[B.PAR_PROGRAM] == "init_testcase": |
|
|
if args[B.PAR_PROGRAM] == "init_testcase": |
|
|
init_testcase.startPyJob(childJob) |
|
|
init_testcase.startPyJob(childJob) |
|
@ -170,6 +160,13 @@ def start_child_process(job, args): |
|
|
finish_testsuite.startPyJob(childJob) |
|
|
finish_testsuite.startPyJob(childJob) |
|
|
elif args[B.PAR_PROGRAM] == "test_executer": |
|
|
elif args[B.PAR_PROGRAM] == "test_executer": |
|
|
test_executer.startPyJob(childJob) |
|
|
test_executer.startPyJob(childJob) |
|
|
|
|
|
elif args[B.PAR_PROGRAM] == "check_environment": |
|
|
|
|
|
check_environment.startPyJob(childJob) |
|
|
|
|
|
elif args[B.PAR_PROGRAM] == "check_configuration": |
|
|
|
|
|
check_configuration.startPyJob(childJob) |
|
|
|
|
|
elif args[B.PAR_PROGRAM] == "check_specification": |
|
|
|
|
|
check_specification.startPyJob(childJob) |
|
|
|
|
|
childJob.stopJob(1) |
|
|
return childJob |
|
|
return childJob |
|
|
|
|
|
|
|
|
def select_gran(job, programDef): |
|
|
def select_gran(job, programDef): |
|
@ -177,14 +174,7 @@ def select_gran(job, programDef): |
|
|
select one of testcase, testsuite or testplan |
|
|
select one of testcase, testsuite or testplan |
|
|
:return: |
|
|
:return: |
|
|
""" |
|
|
""" |
|
|
return LIST_GRAN |
|
|
return J.LIST_GRAN |
|
|
|
|
|
|
|
|
def select_environment(job, programDef): |
|
|
|
|
|
""" |
|
|
|
|
|
read environments and select one of them |
|
|
|
|
|
:return: |
|
|
|
|
|
""" |
|
|
|
|
|
return "" |
|
|
|
|
|
|
|
|
|
|
|
def select_project(job, programDef): |
|
|
def select_project(job, programDef): |
|
|
""" |
|
|
""" |
|
@ -192,27 +182,86 @@ def select_project(job, programDef): |
|
|
:return: |
|
|
:return: |
|
|
""" |
|
|
""" |
|
|
# the implemented projects which are configured in conf/basic.yml |
|
|
# the implemented projects which are configured in conf/basic.yml |
|
|
return [""] |
|
|
return ["a", "b", "c"] |
|
|
|
|
|
|
|
|
def select_application(job, programDef, project): |
|
|
def select_application(job, programDef, project): |
|
|
""" |
|
|
""" |
|
|
read the application of the project and select one of them |
|
|
read the application of the project and select one of them |
|
|
:return: |
|
|
:return: |
|
|
""" |
|
|
""" |
|
|
|
|
|
verify = job.m.getLogLevel("job_tool") |
|
|
|
|
|
job.m.logDebug(verify, "select_application "+project) |
|
|
# the application are configured in comp/applications.yml which are optionally stored in the database |
|
|
# the application are configured in comp/applications.yml which are optionally stored in the database |
|
|
return "" |
|
|
projList = [project] |
|
|
|
|
|
apps = model.application.select_applications(job, projList) |
|
|
|
|
|
return list(apps.keys()) |
|
|
|
|
|
|
|
|
|
|
|
def select_environment(job, programDef, project): |
|
|
|
|
|
""" |
|
|
|
|
|
read environments and select one of them |
|
|
|
|
|
:return: |
|
|
|
|
|
""" |
|
|
|
|
|
print("selectr env "+project) |
|
|
|
|
|
projList = [project] |
|
|
|
|
|
envs = model.environment.select_environments(job, projList) |
|
|
|
|
|
return list(envs.keys()) |
|
|
|
|
|
|
|
|
def select_spec(job, programDef, gran, application): |
|
|
def select_spec(job, programDef, gran, args): |
|
|
""" |
|
|
""" |
|
|
read the testspec of the granularity,application and select one of them with the variant |
|
|
read the testspec of the granularity,application and select one of them with the variant |
|
|
:return: |
|
|
:return: |
|
|
""" |
|
|
""" |
|
|
return "" |
|
|
print("select spec "+gran+" "+str(args)) |
|
|
|
|
|
if gran in [J.GRAN_TP.lower(), J.GRAN_TP]: |
|
|
|
|
|
print("select tp spec " + gran) |
|
|
|
|
|
return [] |
|
|
|
|
|
elif gran in [B.PAR_TESTSUITE, J.GRAN_TS]: |
|
|
|
|
|
print("select ts spec " + gran) |
|
|
|
|
|
out = model.testsuite.select_testsuites(job, [args[B.PAR_PROJ]], [args[B.PAR_APP]]) |
|
|
|
|
|
return list(out.keys()) |
|
|
|
|
|
elif gran in [B.PAR_TESTCASE, J.GRAN_TC]: |
|
|
|
|
|
print("select tc spec " + gran) |
|
|
|
|
|
out = model.testcase.select_testcases(job, [args[B.PAR_PROJ]], [args[B.PAR_APP]]) |
|
|
|
|
|
return list(out.keys()) |
|
|
|
|
|
print("select no spec "+gran) |
|
|
|
|
|
|
|
|
def select_archiv(job, programDef, gran, project): |
|
|
def select_archiv(job, programDef, gran, project): |
|
|
""" |
|
|
""" |
|
|
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: |
|
|
""" |
|
|
""" |
|
|
return "" |
|
|
print("select archiv") |
|
|
|
|
|
return ["a", "b", "c"] |
|
|
|
|
|
|
|
|
|
|
|
def select_testtime(job, programDef, gran, args): |
|
|
|
|
|
""" |
|
|
|
|
|
read the testobjects of the granularity,project and select one of them with the time |
|
|
|
|
|
:return: |
|
|
|
|
|
""" |
|
|
|
|
|
return ["a", "b", "c"] |
|
|
|
|
|
|
|
|
|
|
|
def select_variant(job, programDef, gran, args): |
|
|
|
|
|
""" |
|
|
|
|
|
read the testobjects of the granularity,project and select one of them with the time |
|
|
|
|
|
:return: |
|
|
|
|
|
""" |
|
|
|
|
|
print("select spec "+gran) |
|
|
|
|
|
if gran == J.GRAN_TP.lower(): |
|
|
|
|
|
print("select tp spec " + gran) |
|
|
|
|
|
return [""] |
|
|
|
|
|
elif gran in [B.PAR_TESTSUITE, J.GRAN_TS]: |
|
|
|
|
|
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]: |
|
|
|
|
|
print("select tc spec " + gran + " " + str(args)) |
|
|
|
|
|
out = model.testcase.select_testcase(job, args[B.PAR_PROJ], args[B.PAR_TESTCASE]) |
|
|
|
|
|
if "variant" not in out: |
|
|
|
|
|
return [""] |
|
|
|
|
|
return list(out["variant"].keys()) |
|
|
|
|
|
else: |
|
|
|
|
|
raise Exception("for gran "+gran+" variant can not be selected") |
|
|
|
|
|
print("select no spec "+gran) |
|
|
|
|
|
|
|
|