Browse Source

start dialog: testsuite

refactor
Ulrich 2 years ago
parent
commit
cdf12cf68b
  1. 2
      basic/component.py
  2. 2
      basic/constants.py
  3. 2
      basic/program.py
  4. 74
      model/application.py
  5. 4
      model/catalog.py
  6. 32
      model/entity.py
  7. 41
      model/environment.py
  8. 53
      model/testcase.py
  9. 4
      model/testplan.py
  10. 54
      model/testsuite.py
  11. 2
      test/test_07catalog.py
  12. 40
      test/test_20application.py
  13. 41
      test/test_21environment.py
  14. 41
      test/test_26testsuite.py
  15. 4
      test/test_31tdata.py
  16. 0
      test/test_42compare.py
  17. 2
      test/test_43report.py
  18. 0
      test/test_44gen.py
  19. 0
      tools/git_tool.py
  20. 2
      unit_tester.py

2
basic/component.py

@ -43,7 +43,7 @@ def syncEnitity(job, elem):
dbTime = basic.entity.VAL_ZERO_TIME
# get git-commit
if "git" in syncMethod:
comppath = tools.config_tool.getConfigPath(job, P.KEY_COMP, elem)
comppath = tools.config_tool.select_config_path(job, P.KEY_COMP, elem)
repopath = comppath[len(job.conf[B.SUBJECT_PATH][B.ATTR_PATH_COMPS]) + 1:]
gitresult = tools.git_tool.gitLog(job, B.ATTR_PATH_COMPS, repopath, 1)
fileTime = gitresult[0]["date"]

2
basic/constants.py

@ -67,7 +67,7 @@ PAR_STRING = 'parstring'
PAR_TESTPLAN = "testplan"
PAR_TESTCASE = "testcase"
PAR_TESTCASES = "testcases"
PAR_TESTSUITE = "usecase"
PAR_TESTSUITE = "testsuite"
# todo Trennung testsuite - usecase denn n:1-Zuordnung
PAR_TCTIME = "tctime"
PAR_TSTIME = "tstime"

2
basic/program.py

@ -142,7 +142,7 @@ class Job:
catalog = model.catalog.Catalog.getInstance()
self.programDef = catalog.getValue(self, CTLG_NAME, program, "")
try:
path = tools.config_tool.getConfigPath(self, P.KEY_BASIC, B.BASIS_FILE)
path = tools.config_tool.select_config_path(self, P.KEY_BASIC, B.BASIS_FILE)
self.conf = self.getConfiguration(path)
except:
print("FATAL: config-file could not be loaded")

74
model/application.py

@ -5,14 +5,14 @@
import os
import basic.toolHandling
import basic.constants as B
import basic.entity
import utils.path_const as P
import utils.config_tool
import utils.file_tool
import utils.git_tool
import model.entity
import tools.path_const as P
import tools.config_tool
import tools.file_tool
import tools.git_tool
TABLE_NAMES = ["application", "ap_project", "ap_component"]
DEFAULT_SYNC = basic.entity.SYNC_FULL_GIT2DB
DEFAULT_SYNC = model.entity.SYNC_FULL_GIT2DB
def getProjects(job):
"""
@ -21,7 +21,7 @@ def getProjects(job):
:param job:
:return:
"""
appl = utils.config_tool.getConfig(job, P.KEY_BASIC, B.SUBJECT_APPS)
appl = tools.config_tool.getConfig(job, P.KEY_BASIC, B.SUBJECT_APPS)
return searchProjects(job, appl)
def searchProjects(job, appl):
@ -66,27 +66,27 @@ def getEnvironments(job, projectList):
continue
if hasattr(job.par, B.PAR_ENV) and envdir != getattr(job.par, B.PAR_ENV):
continue
for format in utils.config_tool.CONFIG_FORMAT:
for format in tools.config_tool.CONFIG_FORMAT:
pathname = os.path.join(job.conf.getPath(P.ATTR_PATH_ENV),
envdir, P.VAL_CONFIG, P.KEY_TOOL + "_conn." + format)
if os.path.exists(pathname):
break
if os.path.exists(pathname):
doc = utils.file_tool.readFileDict(job, pathname, job.m)
doc = tools.file_tool.readFileDict(job, pathname, job.m)
print(str(doc))
for proj in doc[B.SUBJECT_ENV][B.CONF_NODE_GENERAL][B.SUBJECT_PROJECTS]:
if proj in projectList:
projects[proj][B.SUBJECT_ENV].append(envdir)
return projects
def getApplications(job, projectList):
def select_applications(job, projectList):
"""
get all project which are configured for the workspace
with all environments where the application of the project are installed
:param job:
:return:
"""
appl = utils.config_tool.getConfig(job, P.KEY_BASIC, B.SUBJECT_APPS)
appl = tools.config_tool.getConfig(job, P.KEY_BASIC, B.SUBJECT_APPS)
return searchApplications(job, projectList, appl)
def searchApplications(job, projectList, appl):
@ -94,8 +94,8 @@ def searchApplications(job, projectList, appl):
for proj in projectList:
if hasattr(job.par, B.PAR_PROJ) and proj != getattr(job.par, B.PAR_PROJ):
continue
for app in appl[B.SUBJECT_PROJECTS][proj][B.SUBJECT_APPS]:
if hasattr(job.par, B.PAR_APP) and app != getattr(job.par, B.PAR_APP):
for app in appl[B.SUBJECT_APPS]:
if B.ATTR_APPS_PROJECT in appl[B.SUBJECT_APPS][app] and proj != appl[B.SUBJECT_APPS][app][B.ATTR_APPS_PROJECT]:
continue
appList[app] = appl[B.SUBJECT_APPS][app]
return appList
@ -115,13 +115,13 @@ def syncEnitities(job):
syncMethod = job.conf["entity"][TABLE_NAMES[0]]["storage"]
if syncMethod.count("-") < 2:
return
fileTime = basic.entity.VAL_ZERO_TIME
dbTime = basic.entity.VAL_ZERO_TIME
fileTime = model.entity.VAL_ZERO_TIME
dbTime = model.entity.VAL_ZERO_TIME
# get git-commit
if "git" in syncMethod:
apppath = utils.config_tool.getConfigPath(job, P.KEY_BASIC, B.SUBJECT_APPS, "")
apppath = tools.config_tool.select_config_path(job, P.KEY_BASIC, B.SUBJECT_APPS, "")
repopath = apppath[len(job.conf[B.SUBJECT_PATH][B.ATTR_PATH_COMPS]) + 1:]
gitresult = utils.git_tool.gitLog(job, B.ATTR_PATH_COMPS, repopath, 1)
gitresult = tools.git_tool.gitLog(job, B.ATTR_PATH_COMPS, repopath, 1)
fileTime = gitresult[0]["date"]
print(str(gitresult))
if "db" in syncMethod:
@ -140,12 +140,12 @@ def syncEnitities(job):
print("db vorne")
(appObjects, appDict) = selectEntities(job, dbi)
print(str(appDict))
applPath = utils.config_tool.getConfigPath(job, P.KEY_BASIC, B.SUBJECT_APPS)
utils.file_tool.writeFileDict(job.m, job, applPath, appDict)
applPath = tools.config_tool.select_config_path(job, P.KEY_BASIC, B.SUBJECT_APPS)
tools.file_tool.writeFileDict(job.m, job, applPath, appDict)
#
elif fileTime > dbTime:
print("git vorne")
applData = utils.config_tool.getConfig(job, P.KEY_BASIC, B.SUBJECT_APPS)
applData = tools.config_tool.getConfig(job, P.KEY_BASIC, B.SUBJECT_APPS)
insertEntities(job, applData, dbTime, dbi)
def selectEntities(job, dbi):
@ -161,7 +161,7 @@ def selectEntities(job, dbi):
ao.setAppRow(row, "")
appDict[B.SUBJECT_APPS][ao.name] = {}
for f in job.testserver.conf[B.DATA_NODE_DDL][TABLE_NAMES[0]][B.DATA_NODE_HEADER]:
if f in basic.entity.ENTITY_FIELDS:
if f in model.entity.ENTITY_FIELDS:
continue
appDict[B.SUBJECT_APPS][ao.name][f] = getattr(ao, f)
apid = ao.apid
@ -178,7 +178,7 @@ def selectEntities(job, dbi):
appDict[B.SUBJECT_PROJECTS][proj][B.SUBJECT_APPS].append(ao.name)
aoproj = getattr(ao, "project")[proj]
for f in job.testserver.conf[B.DATA_NODE_DDL][TABLE_NAMES[1]][B.DATA_NODE_HEADER]:
if f in basic.entity.ENTITY_FIELDS + ["approid", "apid"]:
if f in model.entity.ENTITY_FIELDS + ["approid", "apid"]:
continue
appDict[B.SUBJECT_PROJECTS][proj][f] = aoproj[f]
rows = [row for row in compData[B.DATA_NODE_DATA] if row["apid"] == apid]
@ -192,7 +192,7 @@ def selectEntities(job, dbi):
def insertEntities(job,applData, dbTime, dbi):
# insertRows
# get list of application
if dbTime != basic.entity.VAL_ZERO_TIME:
if dbTime != model.entity.VAL_ZERO_TIME:
for t in TABLE_NAMES:
dbi.deleteRows(t, job)
for app in applData[B.SUBJECT_APPS]:
@ -200,7 +200,7 @@ def insertEntities(job,applData, dbTime, dbi):
ao.readEntity(job, app)
ao.insertEntity(dbi)
class Application(basic.entity.Entity):
class Application(model.entity.Entity):
table = "application"
name = ""
description = ""
@ -226,20 +226,20 @@ class Application(basic.entity.Entity):
self.readEntity(job, name)
def readEntity(self, job, app):
apppath = utils.config_tool.getConfigPath(job, P.KEY_BASIC, B.SUBJECT_APPS, "")
apppath = tools.config_tool.select_config_path(job, P.KEY_BASIC, B.SUBJECT_APPS, "")
repopath = apppath[len(job.conf[B.SUBJECT_PATH][B.ATTR_PATH_COMPS]) + 1:]
gitresult = utils.git_tool.gitLog(job, B.ATTR_PATH_COMPS, repopath, 1)
applData = utils.config_tool.getConfig(job, P.KEY_BASIC, B.SUBJECT_APPS)
gitresult = tools.git_tool.gitLog(job, B.ATTR_PATH_COMPS, repopath, 1)
applData = tools.config_tool.getConfig(job, P.KEY_BASIC, B.SUBJECT_APPS)
# main object
for f in job.testserver.conf[B.DATA_NODE_DDL][TABLE_NAMES[0]][B.DATA_NODE_HEADER]:
if f == basic.entity.ENTITY_NAME:
if f == model.entity.ENTITY_NAME:
setattr(self, f, app)
elif f == basic.entity.ENTITY_ATTRIBUTES:
elif f == model.entity.ENTITY_ATTRIBUTES:
setattr(self, f, {})
elif f in applData[B.SUBJECT_APPS][app]:
setattr(self, f, applData[B.SUBJECT_APPS][app][f])
elif f in basic.entity.ENTITY_FIELDS:
setattr(self, f, basic.entity.getEntityValue(job, f, gitresult[0]))
elif f in model.entity.ENTITY_FIELDS:
setattr(self, f, model.entity.getEntityValue(job, f, gitresult[0]))
else:
setattr(self, f, "xx")
project = {}
@ -247,16 +247,16 @@ class Application(basic.entity.Entity):
for proj in applData[B.SUBJECT_APPS][app][B.SUBJECT_PROJECTS]:
project[proj] = {}
for f in job.testserver.conf[B.DATA_NODE_DDL][TABLE_NAMES[1]][B.DATA_NODE_HEADER]:
if f == basic.entity.ENTITY_NAME:
if f == model.entity.ENTITY_NAME:
project[proj][f] = proj
elif f == "project":
project[proj][f] = proj
elif f == basic.entity.ENTITY_ATTRIBUTES:
elif f == model.entity.ENTITY_ATTRIBUTES:
project[proj][f] = {}
elif f in applData[B.SUBJECT_PROJECTS][proj]:
project[proj][f] = applData[B.SUBJECT_PROJECTS][proj][f]
elif f in basic.entity.ENTITY_FIELDS:
project[proj][f] = basic.entity.getEntityValue(job, f, gitresult[0])
elif f in model.entity.ENTITY_FIELDS:
project[proj][f] = model.entity.getEntityValue(job, f, gitresult[0])
else:
project[proj][f] = "xx"
setattr(self, "project", project)
@ -297,7 +297,7 @@ class Application(basic.entity.Entity):
def selectEntity(self, job, app):
dbi = basic.toolHandling.getDbTool(job, job.testserver, job.conf[B.TOPIC_NODE_DB][B.ATTR_TYPE])
data = dbi.selectRows(TABLE_NAMES[0], job, "WHERE name = \'"+app+"\' AND actual = "+basic.entity.ENTITY_ACTUAL)
data = dbi.selectRows(TABLE_NAMES[0], job, "WHERE name = \'" + app +"\' AND actual = " + model.entity.ENTITY_ACTUAL)
# main object
self.setAppRow(data[B.DATA_NODE_DATA][0], app)
apid = getattr(self, "apid")
@ -308,7 +308,7 @@ class Application(basic.entity.Entity):
def setAppRow(self, row, app):
for f in self.job.testserver.conf[B.DATA_NODE_DDL][TABLE_NAMES[0]][B.DATA_NODE_HEADER]:
if f not in row and f == basic.entity.ENTITY_NAME:
if f not in row and f == model.entity.ENTITY_NAME:
setattr(self, f, app)
else:
setattr(self, f, str(row[f]))

4
model/catalog.py

@ -61,7 +61,7 @@ class Catalog:
if subkey not in self.catalog[domain][key]:
job.m.setError(EXP_KEY_DOESNT_EXIST + " (" + domain + ", " + key + ", " + subkey + ")")
return ""
return self.catalog[domain][key][subkey]
return self.catalog[domain][key][subkey].strip()
return self.catalog[domain][key]
@ -95,7 +95,7 @@ class Catalog:
raise Exception(EXP_KEY_MISSING, (domain))
if domain in self.catalog:
return
pathname = tools.config_tool.getConfigPath(job, P.KEY_CATALOG, domain)
pathname = tools.config_tool.select_config_path(job, P.KEY_CATALOG, domain)
if pathname is None:
raise Exception(EXP_KEY_MISSING, (domain))
if hasattr(job, "m"):

32
basic/entity.py → model/entity.py

@ -1,9 +1,11 @@
import getpass
import os
import re
import basic.toolHandling
import utils.data_const as D
import tools.data_const as D
import basic.constants as B
import utils.date_tool
import tools.date_tool
import tools.file_tool
ENTITY_NAME = "name"
ENTITY_ATTRIBUTES = "attributes"
@ -32,7 +34,7 @@ def getEntityValue(job, field, gitcommit):
if field == ENTITY_INS_AUTHOR:
return getpass.getuser()
if field == ENTITY_INS_TIME:
return utils.date_tool.getActdate(utils.date_tool.F_DIR)
return tools.date_tool.getActdate(tools.date_tool.F_DIR)
if field == ENTITY_UPD_COMMIT:
return gitcommit["commit"]
if field == ENTITY_UPD_AUTHOR:
@ -110,3 +112,25 @@ class Entity:
dbi = basic.toolHandling.getDbTool(self.job, None, dbtype)
sql = dbi.getSchemaIndex(table, "actual") + "\n"
return sql
def read_spec(job, testentity, testgran, specpath):
if not os.path.isfile(specpath):
return
text = tools.file_tool.read_file_text(job, specpath, job.m)
if re.match(r".*?depricated;[jJyY]", text):
return None
spec = {}
regex = re.compile(r".*\nhead:(.*?);(.+)")
for res in regex.finditer(text):
#res = re.search(r".*head:(.*?);(.+)\n", text)
key = res.group(1)
if key == B.SUBJECT_DESCRIPTION:
spec[B.SUBJECT_DESCRIPTION] = res.group(2).replace(";", "")
elif key in [B.SUBJECT_APPS, B.PAR_APP]:
apps = res.group(2).replace(";", ",").split(",")
spec[B.SUBJECT_APPS] = apps
else:
val = res.group(2).replace(";", "")
spec[key] = val
return spec

41
model/environment.py

@ -0,0 +1,41 @@
# ---------------------------------------------------------------------------------------------------------
# Author : Ulrich Carmesin
# Source : gitea.ucarmesin.de
# ---------------------------------------------------------------------------------------------------------
import os
import basic.constants as B
import model.entity
import tools.path_const as P
import tools.config_tool
import tools.file_tool
import tools.git_tool
TABLE_NAMES = ["environment", "en_project", "en_component"]
DEFAULT_SYNC = model.entity.SYNC_FULL_GIT2DB
def select_environments(job, projectList):
"""
searches and gets environments in which the applications of the project are declared that these are installed
filtered by parameter --environment
:param job:
:return:
"""
environments = {}
path = job.conf[B.SUBJECT_PATH][B.ATTR_PATH_ENV]
if not os.path.exists(path):
raise Exception("Umgebungsverzeichnis existiert nicht "+path)
for envdir in os.listdir(path):
if not os.path.isdir(os.path.join(path, envdir)):
continue
if envdir[0:1] == "_":
continue
try:
pathname = tools.config_tool.select_config_path(job, P.KEY_TOOL, "conn", envdir)
doc = tools.file_tool.read_file_dict(job, pathname, job.m)
for proj in doc[B.SUBJECT_ENV][B.CONF_NODE_GENERAL][B.SUBJECT_PROJECTS]:
if proj in projectList:
environments[envdir] = doc[B.SUBJECT_ENV][B.CONF_NODE_GENERAL]
except:
continue
return environments

53
basic/testcase.py → model/testcase.py

@ -4,11 +4,19 @@
# Author : Ulrich Carmesin
# Source : gitea.ucarmesin.de
# ---------------------------------------------------------------------------------------------------------
import os
import basic.toolHandling
import utils.data_const as D
import basic.constants as B
import basic.entity
class Testcase(basic.entity.Entity):
import model.entity
import tools.config_tool
import tools.job_tool
import tools.path_tool
import tools.path_const as P
import model.entity
class Testcase(model.entity.Entity):
name = ""
description = ""
application = ""
@ -46,3 +54,44 @@ class Testcase(basic.entity.Entity):
sql += dbi.getSchemaIndex(dbi.getSubTableName("tc", attr),
dbi.getSubTableId(dbi.getSubTableName("tc", attr), attr))+"\n"
return sql
def select_testcase(job, project, testsuite):
jobProj = None
if hasattr(job.par, B.PAR_PROJ):
jobProj = getattr(job.par, B.PAR_PROJ)
setattr(job.par, B.PAR_PROJ, project)
path = tools.path_tool.compose_path(job, P.P_TDROOT, None)
specpath = os.path.join(path, testsuite, D.DFILE_TESTSUITE_NAME + ".csv")
spec = model.entity.read_spec(job, testsuite, tools.job_tool.GRAN_TS, specpath)
if jobProj is None:
delattr(job.par, B.PAR_PROJ)
else:
setattr(job.par, B.PAR_PROJ, jobProj)
return spec
def select_testcases(job, projList, appList):
out = {}
jobProj = None
if hasattr(job.par, B.PAR_PROJ):
jobProj = getattr(job.par, B.PAR_PROJ)
for proj in projList:
setattr(job.par, B.PAR_PROJ, proj)
path = tools.path_tool.compose_path(job, P.P_TDROOT, None)
if os.path.exists(path):
for d in os.listdir(path):
if not os.path.isdir(os.path.join(path, d)):
continue
if d[0:1] == "_":
continue
print(d)
specpath = os.path.join(path, d, D.DFILE_TESTCASE_NAME + ".csv")
spec = model.entity.read_spec(job, d, tools.job_tool.GRAN_TS, specpath)
if spec is None:
continue
out[d] = spec
out[d][B.SUBJECT_PROJECTS] = [proj]
if jobProj is None:
delattr(job.par, B.PAR_PROJ)
else:
setattr(job.par, B.PAR_PROJ, jobProj)
return out

4
basic/testplan.py → model/testplan.py

@ -7,9 +7,9 @@
import basic.toolHandling
import utils.data_const as D
import basic.constants as B
import basic.entity
import model.entity
class Testplan(basic.entity.Entity):
class Testplan(model.entity.Entity):
name = ""
description = ""
release = ""

54
basic/testsuite.py → model/testsuite.py

@ -4,12 +4,19 @@
# Author : Ulrich Carmesin
# Source : gitea.ucarmesin.de
# ---------------------------------------------------------------------------------------------------------
import os
import basic.toolHandling
import utils.data_const as D
import basic.constants as B
import basic.entity
import model.entity
import tools.config_tool
import tools.job_tool
import tools.path_tool
import tools.path_const as P
import model.entity
class Testsuite(basic.entity.Entity):
class Testsuite(model.entity.Entity):
name = ""
description = ""
application = ""
@ -47,3 +54,46 @@ class Testsuite(basic.entity.Entity):
sql += dbi.getSchemaIndex(dbi.getSubTableName("ts", attr),
dbi.getSubTableId(dbi.getSubTableName("ts", attr), attr))+"\n"
return sql
def select_testsuite(job, project, testsuite):
jobProj = None
print("testsuite select: "+str(project)+" "+str(testsuite))
if hasattr(job.par, B.PAR_PROJ):
jobProj = getattr(job.par, B.PAR_PROJ)
setattr(job.par, B.PAR_PROJ, project)
path = tools.path_tool.compose_path(job, P.P_TDROOT, None)
specpath = os.path.join(path, testsuite, D.DFILE_TESTSUITE_NAME + ".csv")
spec = model.entity.read_spec(job, testsuite, tools.job_tool.GRAN_TS, specpath)
if jobProj is None:
delattr(job.par, B.PAR_PROJ)
else:
setattr(job.par, B.PAR_PROJ, jobProj)
return spec
def select_testsuites(job, projList, appList):
out = {}
jobProj = None
print("testsuite select: "+str(projList)+" "+str(appList))
if hasattr(job.par, B.PAR_PROJ):
jobProj = getattr(job.par, B.PAR_PROJ)
for proj in projList:
setattr(job.par, B.PAR_PROJ, proj)
path = tools.path_tool.compose_path(job, P.P_TDROOT, None)
if os.path.exists(path):
for d in os.listdir(path):
if not os.path.isdir(os.path.join(path, d)):
continue
if d[0:1] == "_":
continue
print(d)
specpath = os.path.join(path, d, D.DFILE_TESTSUITE_NAME + ".csv")
spec = model.entity.read_spec(job, d, tools.job_tool.GRAN_TS, specpath)
if spec is None:
continue
out[d] = spec
out[d][B.SUBJECT_PROJECTS] = [proj]
if jobProj is None:
delattr(job.par, B.PAR_PROJ)
else:
setattr(job.par, B.PAR_PROJ, jobProj)
return out

2
test/test_07catalog.py

@ -74,7 +74,7 @@ class MyTestCase(unittest.TestCase):
cnttest += 1
res = catalog.getValue(job, "countries", "TD", "")
print(str(res))
self.assertEqual(res["Land"], "Tschad")
self.assertEqual(res["Land"].strip(), "Tschad")
cnttest += 1
res = catalog.getValue(job, "countries", "TD", "Land")
print(str(res))

40
test/test_20application.py

@ -0,0 +1,40 @@
import unittest
import os
import inspect
import shutil
import tools.path_tool
import basic.program
import test.testtools
import basic.constants as B
import test.constants as T
import tools.file_tool
import model.application
HOME_PATH = test.constants.HOME_PATH
PYTHON_CMD = "python"
TEST_FUNCTIONS = ["test_10getApplications"]
PROGRAM_NAME = "clean_workspace"
class MyTestCase(unittest.TestCase):
mymsg = "--------------------------------------------------------------"
def test_10getApplications(self):
global mymsg
global jobObject
actfunction = str(inspect.currentframe().f_code.co_name)
cnttest = 0
if actfunction not in TEST_FUNCTIONS:
return
# simple job instantiate - without parameter and only simple messaging
job = test.testtools.getJob()
print(str(job.__dict__))
jobObject = job
projList = ["TESTPROJ"]
apps = model.application.select_applications(job, projList)
print(str(apps))
if __name__ == '__main__':
unittest.main()

41
test/test_21environment.py

@ -0,0 +1,41 @@
import unittest
import os
import inspect
import shutil
import tools.path_tool
import basic.program
import test.testtools
import basic.constants as B
import test.constants as T
import tools.file_tool
import model.environment
HOME_PATH = test.constants.HOME_PATH
PYTHON_CMD = "python"
TEST_FUNCTIONS = ["test_10getEnvironments"]
PROGRAM_NAME = "clean_workspace"
class MyTestCase(unittest.TestCase):
mymsg = "--------------------------------------------------------------"
def test_10getEnvironments(self):
global mymsg
global jobObject
actfunction = str(inspect.currentframe().f_code.co_name)
cnttest = 0
if actfunction not in TEST_FUNCTIONS:
return
# simple job instantiate - without parameter and only simple messaging
job = test.testtools.getJob()
print(str(job.__dict__))
jobObject = job
projList = ["TESTPROJ"]
envs = model.environment.select_environments(job, projList)
print(str(envs))
print(str(envs.keys()))
if __name__ == '__main__':
unittest.main()

41
test/test_26testsuite.py

@ -0,0 +1,41 @@
import unittest
import os
import inspect
import shutil
import tools.path_tool
import basic.program
import test.testtools
import basic.constants as B
import test.constants as T
import tools.file_tool
import model.testsuite
HOME_PATH = test.constants.HOME_PATH
PYTHON_CMD = "python"
TEST_FUNCTIONS = ["test_10getEnvironments"]
PROGRAM_NAME = "clean_workspace"
class MyTestCase(unittest.TestCase):
mymsg = "--------------------------------------------------------------"
def test_10getEnvironments(self):
global mymsg
global jobObject
actfunction = str(inspect.currentframe().f_code.co_name)
cnttest = 0
if actfunction not in TEST_FUNCTIONS:
return
# simple job instantiate - without parameter and only simple messaging
job = test.testtools.getJob()
print(str(job.__dict__))
jobObject = job
projList = ["TESTPROJ"]
appList = []
envs = model.testsuite.select_testsuites(job, projList, appList)
print(str(envs))
if __name__ == '__main__':
unittest.main()

4
test/test_21tdata.py → test/test_31tdata.py

@ -38,7 +38,7 @@ class MyTestCase(unittest.TestCase):
setattr(job.par, "tdtyp", "dir")
setattr(job.par, "tdsrc", "TC0001")
setattr(job.par, "tdname", "testspec")
filename = str(job.conf.confs["paths"]["testdata"]) + "/" + getattr(job.par, "tdsrc") + "/" + getattr(job.par, "tdname") + ".csv"
filename = str(job.conf["paths"]["testdata"]) + "/" + getattr(job.par, "tdsrc") + "/" + getattr(job.par, "tdname") + ".csv"
#tdata = t.readCsv(job.m, filename, None)
#self.assertEqual(len(tdata["testa1"]), 3)
setattr(job.par, "tdtyp", "dir")
@ -54,7 +54,7 @@ class MyTestCase(unittest.TestCase):
if actfunction not in TEST_FUNCTIONS:
return
job = test.testtools.getJob()
# filename = os.path.join(job.conf.confs["paths"]["testdata"], getattr(job.par, "tdsrc"), getattr(job.par, "tdname") + ".csv")
# filename = os.path.join(job.conf["paths"]["testdata"], getattr(job.par, "tdsrc"), getattr(job.par, "tdname") + ".csv")
"""
a) data : like a table with data-array of key-value-pairs
a_0 is keyword [option, step, CSV_HEADER_START ]

0
test/test_22compare.py → test/test_42compare.py

2
test/test_23report.py → test/test_43report.py

@ -22,7 +22,7 @@ class MyTestCase(unittest.TestCase):
def getReport(self, job):
# job = test.testtools.getJob()
report = utils.report_tool.Report(job)
archiv = job.conf.confs[B.SUBJECT_PATH][B.ATTR_PATH_ARCHIV]+"/"
archiv = job.conf[B.SUBJECT_PATH][B.ATTR_PATH_ARCHIV]+"/"
i = 0
for m in M.MATCH_TYPES:
report.setPaths("TC0001", "comp01", "arte01", m, archiv+"path0111"+str(i), archiv+"path0111"+str(i)+"02")

0
test/test_24gen.py → test/test_44gen.py

0
utils/git_tool.py → tools/git_tool.py

2
unit_tester.py

@ -42,7 +42,7 @@ def create_test_suite(job):
testnum = t[len(testdir)+11:len(testdir)+13]
if not testnum.isnumeric():
continue
if testnum not in ["01", "03", "08", "10", "11"]:
if testnum not in ["01", "03", "07", "08", "10", "11", "20", "21"]:
continue
if testdir == T.COMP_PATH:
v = "components.test." + t[len(testdir) + 6:-3]

Loading…
Cancel
Save