Data-Test-Executer Framework speziell zum Test von Datenverarbeitungen mit Datengenerierung, Systemvorbereitungen, Einspielungen, ganzheitlicher diversifizierender Vergleich
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

153 lines
5.8 KiB

# ---------------------------------------------------------------------------------------------------------
# Author : Ulrich Carmesin
# Source : gitea.ucarmesin.de
# ---------------------------------------------------------------------------------------------------------
import os
import basic.toolHandling
import basic.componentHandling
import basic.constants as B
import model.entity
import tools.path_const as P
import tools.data_const as D
import tools.config_tool
import tools.file_tool
import tools.git_tool
TABLE_NAME = "step"
""" system-name for this entity """
FIELD_ID = "spid"
FIELD_NAME = "name"
FIELD_DESCRIPTION = B.SUBJECT_DESCRIPTION
FIELD_REFERENCE = B.SUBJECT_REFERENCE
FIELD_COMPONENT = B.SUBJECT_COMP
FIELD_ATTRIBUTES = B.NODE_ATTRIBUTES
LIST_FIELDS = [FIELD_ID, FIELD_NAME, FIELD_DESCRIPTION, FIELD_REFERENCE, FIELD_COMPONENT]
""" list of object-attributes """
LIST_NODES = [B.NODE_ATTRIBUTES, B.DATA_NODE_TOPICS]
LIST_SUBTABLES = []
FILE_EXTENSION = D.DFILE_TYPE_YML
UNIQUE_FIELDS = [FIELD_NAME]
""" unique business field as human identifer """
IDENTIFYER_FIELDS = [FIELD_ID]
""" unique technical field as technical identifer """
STEP_ATTR_NR = "nr"
""" unique number in test-specification / in comp the array-position """
STEP_ATTR_GROUP = "step"
""" step-number in test-specification / in comp the block itself """
STEP_ATTR_COMP = "comp"
""" comp-name which executes the step """
STEP_ATTR_FCT = "fct"
""" fct-name which executes the step in the component """
STEP_ATTR_TOOL_TYPE = "type"
""" interface of the tool, values cli, dbi """
STEP_ATTR_TOOL_NAME = "type"
""" name of the tool, values cli, dbi """
STEP_ATTR_ARGS = "args"
LIST_STEP_ATTR = [STEP_ATTR_NR, STEP_ATTR_GROUP, STEP_ATTR_COMP, STEP_ATTR_FCT,
STEP_ATTR_TOOL_TYPE, STEP_ATTR_TOOL_NAME, STEP_ATTR_ARGS]
FIELDS = {
STEP_ATTR_NR : "nr",
STEP_ATTR_GROUP : "group",
STEP_ATTR_COMP : "comp",
STEP_ATTR_FCT : "fct",
STEP_ATTR_TOOL_TYPE : "tool",
STEP_ATTR_TOOL_NAME : "toolname",
STEP_ATTR_ARGS : "args"
}
# step
# testsuite | testcase | component
#---------------------------------- # ---------------------------------- # ----------------------------------
# start programs # start function #
class Step(model.entity.Entity):
"""
this class describes execution steps in a formal language = fields,
in testcase-specification it describe the start-point of an action, here the business information are specified like
* variant
* reference of program-step, sorting-nr, reference to testdata which are specified above
* entity which implements the action
* further business-arguments as json-string
the detailed steps (build the request, send the request, get the response, ..) are configured in the component
in sub-steps of the specified step, here the technical information are configured like
* topic and type which implements the detail-step
* further arguments inside the dict
"""
name = "" # variant
variant = ""
sortnr = 0
""" sorting, alternative step may have the same sortnr, then the correct step is selected by program-variant """
progstep = 0
""" in order to filter the steps for specific program-executions """
dataref = ""
component = "" # the name of the component or of the parameter "testcases"
arguments = {}
topic = "" # is set by component-configuration
type = "" # is set by component-configuration
def __init__(self, job, project="", name="", obj=None):
"""
to be initialized by readSpec
project : optional
alternative parameter
name : name of variant or default - only from testspec
obj : object with main attributes
:param job:
"""
self.job = job
if len(project) > 1:
self.project = project
if len(name) > 1:
self.name = name
if obj is not None:
self.setEntity(LIST_STEP_ATTR, name, obj)
else:
self.getEntity(job, name)
def read_unique_names(self, job, project, application, gran, args):
"""
reads the entity-names from file-storage
:param job:
:param opt. project: select-criteria if used and defined
:param opt. application: select-criteria if used and defined
:param opt. gran: granularity values testcase / testsuite / testplan
:param opt. args additional args
:return: list of entity-names
"""
config = self.getConfig(job, P.KEY_BASIC, B.SUBJECT_VARIANTS, tools.config_tool.get_plain_filename(job, ""))
outList = list(config[B.SUBJECT_VARIANTS].keys())
return outList
def read_entity(self, job, name):
"""
reads the entity from the file-system
:param job:
:param name:
:return:
"""
config = self.getConfig(job, P.KEY_BASIC, B.SUBJECT_VARIANTS, tools.config_tool.get_plain_filename(job, name))
return self.setAttributes(job, config, name, LIST_FIELDS, LIST_NODES, LIST_SUBTABLES)
def rest_read(self, job, name):
print("step read "+name)
variants = tools.config_tool.getConfig(job, P.KEY_BASIC, B.SUBJECT_VARIANTS)["variants"]
if name not in variants:
raise Exception("Argument Variant "+name+" nicht definiert.")
variant = variants[name]
if not "comp" in variant:
raise Exception("Keine Komponente zu "+name+" definiert.")
cm = basic.componentHandling.ComponentManager.getInstance(job)
comp = cm.getComponent(variant["comp"])
print(str(comp))
def getFieldList(self):
return LIST_FIELDS
def getNodeList(self):
return LIST_NODES
def getSubtableList(self):
return LIST_SUBTABLES