|
|
@ -15,7 +15,10 @@ import tools.job_tool |
|
|
|
import tools.path_tool |
|
|
|
import tools.path_const as P |
|
|
|
import model.entity |
|
|
|
|
|
|
|
import model.story |
|
|
|
import model.document |
|
|
|
import model.step |
|
|
|
import model.table |
|
|
|
|
|
|
|
class Testcase(model.entity.Entity): |
|
|
|
""" |
|
|
@ -28,20 +31,101 @@ class Testcase(model.entity.Entity): |
|
|
|
steps -> comp.step |
|
|
|
tables -> comp.table |
|
|
|
""" |
|
|
|
tcid = "" |
|
|
|
name = "" |
|
|
|
description = "" |
|
|
|
project = "" |
|
|
|
application = "" |
|
|
|
usecase = [] |
|
|
|
reference = "" |
|
|
|
attributes = "" |
|
|
|
story = [] |
|
|
|
docs = [] |
|
|
|
tables = {} |
|
|
|
steps = [] |
|
|
|
|
|
|
|
def __init__(self, job): |
|
|
|
def __init__(self, job, project="", name=""): |
|
|
|
""" |
|
|
|
to be initialized by readSpec |
|
|
|
:param job: |
|
|
|
""" |
|
|
|
self.job = job |
|
|
|
if len(project) > 1: |
|
|
|
self.project = project |
|
|
|
if len(name) > 1: |
|
|
|
self.name = name |
|
|
|
self.getEntity(job, name) |
|
|
|
|
|
|
|
def read_entity(self, job, name): |
|
|
|
""" |
|
|
|
reads the entity from the file-system |
|
|
|
:param job: |
|
|
|
:param name: |
|
|
|
:return: |
|
|
|
""" |
|
|
|
pathname = tools.config_tool.select_config_path(job, P.KEY_TESTCASE, name, "") |
|
|
|
print(pathname) |
|
|
|
(fname, ext) = os.path.splitext(pathname) |
|
|
|
fi = basic.toolHandling.getFileTool(job, None, ext[1:]) |
|
|
|
tdata = fi.load_file(pathname, ttype=D.CSV_SPECTYPE_DATA) |
|
|
|
stories = [] |
|
|
|
docs = [] |
|
|
|
attributes = {} |
|
|
|
pass |
|
|
|
if B.DATA_NODE_HEAD in tdata: |
|
|
|
for h in D.LIST_HEAD_ATTR: |
|
|
|
if h in tdata[B.DATA_NODE_HEAD]: |
|
|
|
setattr(self, h, tdata[B.DATA_NODE_HEAD][h]) |
|
|
|
else: |
|
|
|
job.m.logWarn("Keine Head-Daten in Testcase "+name) |
|
|
|
if B.DATA_NODE_OPTION in tdata: |
|
|
|
for o in tdata[B.DATA_NODE_OPTION]: |
|
|
|
if o in [D.OPT_ATTR_UCID, D.OPT_ATTR_USECASE]: |
|
|
|
pass |
|
|
|
elif o in [D.OPT_ATTR_STORYID, D.OPT_ATTR_STORY]: |
|
|
|
if len(stories) < 1: |
|
|
|
story = model.story.Story(job) |
|
|
|
stories.append(story) |
|
|
|
else: |
|
|
|
story = stories[0] |
|
|
|
setattr(story, model.story.FIELDS[o], tdata[B.DATA_NODE_OPTION][o]) |
|
|
|
elif o in D.LIST_OPT_ATTR: |
|
|
|
setattr(self, o, tdata[B.DATA_NODE_OPTION][o]) |
|
|
|
else: |
|
|
|
attributes[o] = tdata[B.DATA_NODE_OPTION][o] |
|
|
|
else: |
|
|
|
job.m.logWarn("Keine Option-Daten in Testcase "+name) |
|
|
|
if len(attributes) > 0: |
|
|
|
self.attributes = attributes |
|
|
|
if len(stories) > 0: |
|
|
|
self.story = stories |
|
|
|
pass |
|
|
|
if B.DATA_NODE_STEPS in tdata: |
|
|
|
for s in tdata[B.DATA_NODE_STEPS]: |
|
|
|
step = model.step.Step(job, project=job.par.project, name=s) |
|
|
|
pass |
|
|
|
if B.DATA_NODE_TABLES in tdata: |
|
|
|
for t in tdata[B.DATA_NODE_TABLES]: |
|
|
|
table = model.table.Table(job, project=job.par.project, name=t) |
|
|
|
pass |
|
|
|
# for o in tdata[B.option |
|
|
|
# header = tdata[B.DATA_NODE_STEPS][] LIST |
|
|
|
|
|
|
|
# reference |
|
|
|
# |
|
|
|
# for t in tdata[B.tables |
|
|
|
|
|
|
|
#raise Exception(B.EXCEPT_NOT_IMPLEMENT) |
|
|
|
|
|
|
|
def select_entity(self, job, name): |
|
|
|
""" |
|
|
|
reads the entity from the database |
|
|
|
it should get the same result like read_entity |
|
|
|
:param job: |
|
|
|
:param name: |
|
|
|
:return: |
|
|
|
""" |
|
|
|
raise Exception(B.EXCEPT_NOT_IMPLEMENT) |
|
|
|
|
|
|
|
|
|
|
|
def get_schema(self, tableName="", tableObject=None): |
|
|
|
dbtype = self.job.conf[B.TOPIC_NODE_DB][B.ATTR_TYPE] |
|
|
|