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.
 
 
 

109 lines
3.6 KiB

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.step
import model.testcase
HOME_PATH = test.constants.HOME_PATH
PYTHON_CMD = "python"
# TEST_FUNCTIONS = ["test_10getEntityNames", "test_12getEntity", "test_02setEntity", "test_20getStep"]
TEST_FUNCTIONS = ["test_12getEntity"]
PROGRAM_NAME = "clean_workspace"
PROJECT = "TESTPROJ"
class MyTestCase(unittest.TestCase):
mymsg = "--------------------------------------------------------------"
def test_02setEntity(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()
step = model.step.Step(job)
name = "xml-rest"
actproject = step.read_entity(job, name)
self.assertEqual(getattr(actproject, model.step.FIELD_NAME), name)
self.assertRaises(Exception, step.read_entity, job, "xyzxyz")
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()
step = model.step.Step(job)
entityNames = []
entityNames = step.read_unique_names(job, "", "", "", {})
self.assertEqual(type(entityNames), list)
print("apps "+str(entityNames))
#entityNames = component.select_unique_names(job, "", "", "", {})
#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()
step = model.step.Step(job)
name = "xml-rest"
actstep = step.read_entity(job, name)
self.assertEqual(getattr(actstep, model.step.FIELD_NAME), name)
self.assertRaises(Exception, step.read_entity, job, "xyzxyz")
#
testcase = model.testcase.Testcase(job)
tcname = "TC0001"
acttestcase = testcase.read_entity(job, tcname)
print(str(acttestcase.steps))
#actproject = actproject.setAttributes(job, )
#actproject = component.select_entity(job, name)
#self.assertEqual(getattr(actproject, model.component.FIELD_USERNAME), name)
#self.assertRaises(Exception, component.select_entity, job, ["xyzxyz"])
def test_10getSteps(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
def test_20getStep(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
# step-name = variant
step = model.step.Step(job, PROJECT, name="json-rest")
print(str(step))
if __name__ == '__main__':
unittest.main()