Compare commits
3 Commits
5b998760a5
...
6cc11e2bc5
Author | SHA1 | Date |
---|---|---|
Ulrich Carmesin | 6cc11e2bc5 | 2 years ago |
Ulrich Carmesin | 3e9af836b9 | 2 years ago |
Ulrich Carmesin | 24c3970d9d | 2 years ago |
12 changed files with 242 additions and 31 deletions
@ -0,0 +1,91 @@ |
|||
#!/usr/bin/python |
|||
# -*- coding: utf-8 -*- |
|||
# --------------------------------------------------------------------------------------------------------- |
|||
# Author : Ulrich Carmesin |
|||
# Source : gitea.ucarmesin.de |
|||
# --------------------------------------------------------------------------------------------------------- |
|||
""" |
|||
this module implements the functionality of a test-step |
|||
which is defined in the test-specification |
|||
and is executed by any executer |
|||
there are 2 kinds of test-step |
|||
a) execute specific component in the job |
|||
b) execute specific test-entity in the test-suite-execution |
|||
""" |
|||
import basic.constants as B |
|||
import utils.data_const as D |
|||
|
|||
LIST_ARGS = [ |
|||
"start", # for starting the specified main-program |
|||
"fct" # for calling the specified component-function |
|||
] |
|||
|
|||
class Step: |
|||
comp = "" |
|||
refLine = "" # in a: references the data-line(s) to be executed |
|||
execStep = "" # in a,b: executes only if the step is set in the job |
|||
args = {} |
|||
""" |
|||
the class contains each attribute of a test-step |
|||
""" |
|||
def __init__(self): |
|||
self.comp = "" |
|||
self.refLine = "" |
|||
self.execStep = "" |
|||
self.args = {} |
|||
|
|||
|
|||
def parseOldStep(job, fields): |
|||
step = {} |
|||
step[B.DATA_NODE_COMP] = fields[D.STEP_COMP_I] |
|||
step[B.ATTR_EXEC_REF] = fields[D.STEP_EXECNR_I] |
|||
step[B.ATTR_DATA_REF] = fields[D.STEP_REFNR_I] |
|||
step[B.ATTR_STEP_ARGS] = {} |
|||
if D.STEP_ARGS_I == D.STEP_LIST_I: |
|||
args = "" |
|||
for i in range(D.STEP_ARGS_I, len(fields)): |
|||
if len(fields[i]) < 1: |
|||
continue |
|||
if fields[i][0:1] == "#": |
|||
continue |
|||
args += "," + fields[i] |
|||
args = args[1:] |
|||
else: |
|||
args = fields[D.STEP_ARGS_I] |
|||
a = args.split(",") |
|||
for arg in a: |
|||
print("arg " + arg) |
|||
b = arg.split(":") |
|||
if len(b) < 2: |
|||
raise Exception(D.EXCP_MALFORMAT + "" + l) |
|||
step[B.ATTR_STEP_ARGS][b[0]] = b[1] |
|||
# data[B.DATA_NODE_STEPS].append(step) |
|||
return step |
|||
|
|||
def parseStep(job, fields): |
|||
step = Step |
|||
step.comp = fields[D.STEP_COMP_I] |
|||
step.execStep = fields[D.STEP_EXECNR_I] |
|||
step.refLine = fields[D.STEP_REFNR_I] |
|||
if D.STEP_ARGS_I == D.STEP_LIST_I: |
|||
args = "" |
|||
for i in range(D.STEP_ARGS_I, len(fields)): |
|||
if len(fields[i]) < 1: |
|||
continue |
|||
if fields[i][0:1] == "#": |
|||
continue |
|||
args += "," + fields[i] |
|||
args = args[1:] |
|||
else: |
|||
args = fields[D.STEP_ARGS_I] |
|||
a = args.split(",") |
|||
for arg in a: |
|||
print("arg " + arg) |
|||
b = arg.split(":") |
|||
if len(b) < 2: |
|||
raise Exception(D.EXCP_MALFORMAT + "" + str(fields)) |
|||
step.args[b[0]] = b[1] |
|||
if b[0] in LIST_ARGS: |
|||
setattr(step, b[0], b[1]) |
|||
# data[B.DATA_NODE_STEPS].append(step) |
|||
return step |
Loading…
Reference in new issue