Ulrich
1 year ago
10 changed files with 222 additions and 199 deletions
@ -1,92 +0,0 @@ |
|||
#!/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 |
|||
import utils.i18n_tool |
|||
|
|||
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 |
|||
* comp : the component which implements the step |
|||
* refLine : reference to data-lines which has to be executed |
|||
+ execStep : |
|||
""" |
|||
def __init__(self): |
|||
self.comp = "" |
|||
self.refLine = "" |
|||
self.execStep = "" |
|||
self.variante = "" |
|||
self.args = {} |
|||
|
|||
def getStepText(self, job): |
|||
text = self.comp+D.CSV_DELIMITER+str(self.execStep)+D.CSV_DELIMITER+self.refLine |
|||
for k in self.args: |
|||
text += D.CSV_DELIMITER+k+":"+self.args[k] |
|||
return text+"\n" |
|||
|
|||
|
|||
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] |
|||
step.variante = fields[D.STEP_VARIANT_I] |
|||
setattr(step, B.ATTR_DATA_REF, step.refLine) |
|||
i = 0 |
|||
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: |
|||
i = D.STEP_ARGS_I |
|||
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 + " in arg["+str(i)+ "] " + str(fields)) |
|||
step.args[b[0]] = b[1] |
|||
if b[0] in LIST_ARGS: |
|||
setattr(step, b[0], b[1]) |
|||
i += 1 |
|||
# data[B.DATA_NODE_STEPS].append(step) |
|||
return step |
|||
|
|||
def getStepHeader(job): |
|||
text = "# " |
|||
text += utils.i18n_tool.I18n.getInstance(job).getText(f"{D.CSV_BLOCK_STEP=}", job) |
|||
text += ";"+utils.i18n_tool.I18n.getInstance(job).getText(f"{D.STEP_ATTR_COMP=}", job) |
|||
text += ";"+utils.i18n_tool.I18n.getInstance(job).getText(f"{D.STEP_ATTR_EXECNR=}", job) |
|||
text += ";"+utils.i18n_tool.I18n.getInstance(job).getText(f"{D.STEP_ATTR_REFNR=}", job) |
|||
text += ";"+utils.i18n_tool.I18n.getInstance(job).getText(f"{D.STEP_ATTR_ARGS=}", job) |
|||
return text + ";..;;;\n" |
|||
|
|||
|
@ -0,0 +1,22 @@ |
|||
#!/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 tools.data_const as D |
|||
# import utils.i18n_tool |
|||
|
|||
LIST_ARGS = [ |
|||
"start", # for starting the specified main-program |
|||
"fct" # for calling the specified component-function |
|||
] |
Loading…
Reference in new issue