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.

105 lines
3.9 KiB

#!/usr/bin/python
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------------------------------------
# Author : Ulrich Carmesin
# Source : gitea.ucarmesin.de
# ---------------------------------------------------------------------------------------------------------
import unittest
import inspect
import test.testtools
import basic.constants as B
import test.constants as T
import model.testcase
import model.entity
HOME_PATH = test.constants.HOME_PATH
PYTHON_CMD = "python"
TEST_FUNCTIONS = ["test_10getEntityNames", "test_11getEntities", "test_12getEntity",
"test_13writeEntity", "test_14insertEntity"]
TEST_FUNCTIONS = ["test_20setSubtable"]
PROGRAM_NAME = "clean_workspace"
class MyTestCase(unittest.TestCase):
mymsg = "--------------------------------------------------------------"
def test_10getEntityNames(self):
global mymsg
global jobObject
actfunction = str(inspect.currentframe().f_code.co_name)
cnttest = 0
if actfunction not in TEST_FUNCTIONS:
return
job = test.testtools.getJob()
testcase = model.testcase.Testcase(job, "TESTPROJ")
entityNames = testcase.read_unique_names(job, "", "", "", {})
self.assertEqual(type(entityNames), list)
#entityNames = project.select_unique_names(job, "", "", "", {})
#self.assertEqual(type(entityNames), list)
def test_11getEntities(self):
global mymsg
global jobObject
actfunction = str(inspect.currentframe().f_code.co_name)
cnttest = 0
if actfunction not in TEST_FUNCTIONS:
return
job = test.testtools.getJob()
testcase = model.testcase.Testcase(job, "TESTPROJ")
entityNames = []
entityNames = testcase.get_entities(job, storage=model.entity.STORAGE_FILE)
self.assertEqual(type(entityNames), list)
#entityNames = testcase.get_entities(job, storage=model.entity.STORAGE_DB)
#self.assertEqual(type(entityNames), list)
def test_12getEntity(self):
global mymsg
global jobObject
actfunction = str(inspect.currentframe().f_code.co_name)
cnttest = 0
if actfunction not in TEST_FUNCTIONS:
return
job = test.testtools.getJob()
testcase = model.testcase.Testcase(job, "TESTPROJ")
name = "TC0001"
acttestcase = testcase.read_entity(job, name)
self.assertEqual(getattr(acttestcase, model.testcase.FIELD_NAME), name)
self.assertRaises(Exception, testcase.read_entity, job, "xyzxyz")
def test_20setSubtable(self):
global mymsg
global jobObject
actfunction = str(inspect.currentframe().f_code.co_name)
cnttest = 0
if actfunction not in TEST_FUNCTIONS:
return
job = test.testtools.getJob()
testcase = model.testcase.Testcase(job, "TESTPROJ")
#testcase.set_subtables(job, {})
tdata = {
"_name": "TC0001",
"_head": {
B.SUBJECT_APP: "TESTPROJ||||||"
},
B.DATA_NODE_OPTION: {
"_input": "testa",
"story-description": "ösdigjiuj||||||",
"story": "US-1234||||||",
"story-id": "US-1234||||||"
}
}
result = testcase.set_subtables(job, tdata)
print(str(result))
self.assertIn(B.SUBJECT_APP, result)
self.assertIn(B.SUBJECT_STORY, result)
self.assertNotIn(B.SUBJECT_USECASE, result)
tdata[B.DATA_NODE_OPTION][B.SUBJECT_USECASE] = "UC-321||UC-123||||"
tdata[B.DATA_NODE_OPTION]["usecase-description"] = "ldkfj||kdjf||||"
result = testcase.set_subtables(job, tdata)
self.assertIn(B.SUBJECT_USECASE, result)
print(str(result))
self.assertEqual(2, len(result[B.SUBJECT_USECASE][B.DATA_NODE_DATA]))
if __name__ == '__main__':
unittest.main()