|
@ -1,12 +1,9 @@ |
|
|
import unittest |
|
|
import unittest |
|
|
import os |
|
|
import inspect |
|
|
|
|
|
import test.testtools |
|
|
import basic.program |
|
|
|
|
|
import basic.program |
|
|
import basic.program |
|
|
import components.component |
|
|
import basic.component |
|
|
from basic.componentHandling import ComponentManager |
|
|
from basic.componentHandling import ComponentManager |
|
|
import init_testcase |
|
|
|
|
|
import test_executer |
|
|
|
|
|
import test.constants |
|
|
import test.constants |
|
|
import utils.report_tool |
|
|
import utils.report_tool |
|
|
import utils.match_tool |
|
|
import utils.match_tool |
|
@ -14,8 +11,13 @@ import utils.match_const as M |
|
|
import basic.constants as B |
|
|
import basic.constants as B |
|
|
|
|
|
|
|
|
HOME_PATH = test.constants.HOME_PATH |
|
|
HOME_PATH = test.constants.HOME_PATH |
|
|
|
|
|
DATA_PATH = test.constants.DATA_PATH |
|
|
|
|
|
TEST_FUNCTIONS = ["test_20cssClass", "test_21title", "test_22overview", "test_23filename", |
|
|
|
|
|
"test_24headlines", "test_30reportS"] |
|
|
|
|
|
TEST_FUNCTIONS = ["test_21title"] |
|
|
|
|
|
|
|
|
class MyTestCase(unittest.TestCase): |
|
|
class MyTestCase(unittest.TestCase): |
|
|
|
|
|
mymsg = "--------------------------------------------------------------" |
|
|
|
|
|
|
|
|
def getReport(self): |
|
|
def getReport(self): |
|
|
job = basic.program.Job.getInstance() |
|
|
job = basic.program.Job.getInstance() |
|
@ -38,20 +40,28 @@ class MyTestCase(unittest.TestCase): |
|
|
i = 0 |
|
|
i = 0 |
|
|
return report |
|
|
return report |
|
|
|
|
|
|
|
|
def test_cssClass(self): |
|
|
def test_20cssClass(self): |
|
|
job = basic.program.Job("unit") |
|
|
global mymsg |
|
|
args = { "application": "TEST", "environment": "ENV01", "modus": "unit", "tstime": "2022-03-19_12-09-09", |
|
|
actfunction = str(inspect.currentframe().f_code.co_name) |
|
|
"tsdir": '/home/ulrich/6_Projekte/Programme/datest/test/conf/lauf/testlauf/TST001_2022-03-19_12-09-09', |
|
|
cnttest = 0 |
|
|
"step": 2 } |
|
|
if actfunction not in TEST_FUNCTIONS: |
|
|
# "usecase": "TST001", "tstime": "2022-03-17_17-28"} |
|
|
return |
|
|
job.par.setParameterArgs(args) |
|
|
job = test.testtools.getJob() |
|
|
job.setProgram("test_executer") |
|
|
#job = basic.program.Job("unit") |
|
|
|
|
|
#args = { "application": "TEST", "environment": "ENV01", "modus": "unit", "tstime": "2022-03-19_12-09-09", |
|
|
|
|
|
# "tsdir": '/home/ulrich/6_Projekte/Programme/datest/test/conf/lauf/testlauf/TST001_2022-03-19_12-09-09', |
|
|
|
|
|
# "step": 2 } |
|
|
|
|
|
## "usecase": "TST001", "tstime": "2022-03-17_17-28"} |
|
|
|
|
|
#job.par.setParameterArgs(args) |
|
|
|
|
|
#job.setProgram("test_executer") |
|
|
|
|
|
job = test.testtools.getJob() |
|
|
report = self.getReport() |
|
|
report = self.getReport() |
|
|
i = 0 |
|
|
i = 0 |
|
|
for m in M.MATCH_TYPES: |
|
|
for m in M.MATCH_TYPES: |
|
|
cssClass = report.getCssClass("TC0001", "comp01", "arte01", m) |
|
|
cssClass = report.getCssClass("TC0001", "comp01", "arte01", m) |
|
|
print(m + " test0111 " + cssClass) |
|
|
print(m + " test0111 " + cssClass) |
|
|
self.assertEqual(cssClass, "result"+str(i)) |
|
|
self.assertEqual(cssClass, "result"+str(i)) |
|
|
|
|
|
cnttest += 1 |
|
|
i += 1 |
|
|
i += 1 |
|
|
if i > 4: |
|
|
if i > 4: |
|
|
i = 0 |
|
|
i = 0 |
|
@ -67,11 +77,18 @@ class MyTestCase(unittest.TestCase): |
|
|
self.assertEqual(cssClass, "result1") |
|
|
self.assertEqual(cssClass, "result1") |
|
|
cssClass = report.getCssClass("TC0002") |
|
|
cssClass = report.getCssClass("TC0002") |
|
|
self.assertEqual(cssClass, "result4") |
|
|
self.assertEqual(cssClass, "result4") |
|
|
|
|
|
cnttest += 4 |
|
|
|
|
|
MyTestCase.mymsg += "\n----- "+actfunction+" : "+str(cnttest) |
|
|
|
|
|
|
|
|
def test_title(self): |
|
|
def test_21title(self): |
|
|
job = basic.program.Job.getInstance() |
|
|
global mymsg |
|
|
|
|
|
actfunction = str(inspect.currentframe().f_code.co_name) |
|
|
|
|
|
cnttest = 0 |
|
|
|
|
|
if actfunction not in TEST_FUNCTIONS: |
|
|
|
|
|
return |
|
|
|
|
|
job = test.testtools.getJob() |
|
|
print(" ---------- test_title") |
|
|
print(" ---------- test_title") |
|
|
setattr(job.par, "testsuite", "TST001") |
|
|
setattr(job.par, B.PAR_TESTSUITE, "TST001") |
|
|
report = self.getReport() |
|
|
report = self.getReport() |
|
|
html = report.getTitle("TC0001", "comp01", "arte01", M.MATCH_POSTCOND) |
|
|
html = report.getTitle("TC0001", "comp01", "arte01", M.MATCH_POSTCOND) |
|
|
print(html) |
|
|
print(html) |
|
@ -79,44 +96,64 @@ class MyTestCase(unittest.TestCase): |
|
|
self.assertEqual((utils.report_tool.REP_TITLE in html), True) |
|
|
self.assertEqual((utils.report_tool.REP_TITLE in html), True) |
|
|
self.assertEqual((utils.report_tool.REP_TC in html), True) |
|
|
self.assertEqual((utils.report_tool.REP_TC in html), True) |
|
|
self.assertEqual(("TC0001" in html), True) |
|
|
self.assertEqual(("TC0001" in html), True) |
|
|
|
|
|
cnttest += 3 |
|
|
html = report.getTitle() |
|
|
html = report.getTitle() |
|
|
self.assertEqual((utils.report_tool.REP_TITLE in html), True) |
|
|
self.assertEqual((utils.report_tool.REP_TITLE in html), True) |
|
|
self.assertEqual((utils.report_tool.REP_TS in html), True) |
|
|
self.assertEqual((utils.report_tool.REP_TS in html), True) |
|
|
self.assertEqual(("TST001" in html), True) |
|
|
self.assertEqual(("TST001" in html), True) |
|
|
|
|
|
cnttest += 3 |
|
|
|
|
|
MyTestCase.mymsg += "\n----- "+actfunction+" : "+str(cnttest) |
|
|
|
|
|
|
|
|
def test_overview(self): |
|
|
def test_22overview(self): |
|
|
job = basic.program.Job.getInstance() |
|
|
global mymsg |
|
|
|
|
|
actfunction = str(inspect.currentframe().f_code.co_name) |
|
|
|
|
|
cnttest = 0 |
|
|
|
|
|
if actfunction not in TEST_FUNCTIONS: |
|
|
|
|
|
return |
|
|
|
|
|
job = test.testtools.getJob() |
|
|
print(" ---------- test_overview") |
|
|
print(" ---------- test_overview") |
|
|
report = self.getReport() |
|
|
report = self.getReport() |
|
|
html = report.getOverview("TC0001") |
|
|
html = report.getOverview("TC0001") |
|
|
print(html) |
|
|
print(html) |
|
|
|
|
|
MyTestCase.mymsg += "\n----- "+actfunction+" : "+str(cnttest) |
|
|
|
|
|
|
|
|
def test_filename(self): |
|
|
def test_23filename(self): |
|
|
job = basic.program.Job.getInstance() |
|
|
global mymsg |
|
|
|
|
|
actfunction = str(inspect.currentframe().f_code.co_name) |
|
|
|
|
|
cnttest = 0 |
|
|
|
|
|
if actfunction not in TEST_FUNCTIONS: |
|
|
|
|
|
return |
|
|
|
|
|
#job = basic.program.Job.getInstance() |
|
|
|
|
|
job = test.testtools.getJob() |
|
|
setattr(job.par, "testcase", "TC0001") |
|
|
setattr(job.par, "testcase", "TC0001") |
|
|
setattr(job.par, "tctime", "2022-03-23_21-23-32") |
|
|
setattr(job.par, "tctime", "2022-03-23_21-23-32") |
|
|
print(" ---------- test_filename") |
|
|
print(" ---------- test_filename") |
|
|
cm = basic.componentHandling.ComponentManager() |
|
|
cm = basic.componentHandling.ComponentManager() |
|
|
for c in ["comp02"]: |
|
|
for c in ["comp02"]: |
|
|
comp = components.component.Component() |
|
|
comp = basic.component.Component() |
|
|
comp.conf = {} |
|
|
comp.conf = {} |
|
|
comp.name = c |
|
|
comp.name = c |
|
|
basic.componentHandling.comps[c] = comp |
|
|
cm.comps[c] = comp |
|
|
report = self.getReport() |
|
|
report = self.getReport() |
|
|
html = report.getFilepath("TC0001", "comp02", "arte01", M.MATCH_POSTCOND) |
|
|
html = report.getFilepath("TC0001", "comp02", "arte01", M.MATCH_POSTCOND) |
|
|
print(html) |
|
|
print(html) |
|
|
|
|
|
MyTestCase.mymsg += "\n----- "+actfunction+" : "+str(cnttest) |
|
|
|
|
|
|
|
|
|
|
|
def test_24headlines(self): |
|
|
def test_headlines(self): |
|
|
global mymsg |
|
|
job = basic.program.Job.getInstance() |
|
|
actfunction = str(inspect.currentframe().f_code.co_name) |
|
|
|
|
|
cnttest = 0 |
|
|
|
|
|
if actfunction not in TEST_FUNCTIONS: |
|
|
|
|
|
return |
|
|
|
|
|
job = test.testtools.getJob() |
|
|
setattr(job.par, "testcase", "TC0001") |
|
|
setattr(job.par, "testcase", "TC0001") |
|
|
setattr(job.par, "tctime", "2022-03-23_21-23-32") |
|
|
setattr(job.par, "tctime", "2022-03-23_21-23-32") |
|
|
cm = basic.componentHandling.ComponentManager() |
|
|
cm = basic.componentHandling.ComponentManager() |
|
|
for c in ["comp02"]: |
|
|
for c in ["comp02"]: |
|
|
comp = components.component.Component() |
|
|
comp = basic.component.Component() |
|
|
comp.conf = {} |
|
|
comp.conf = {} |
|
|
comp.name = c |
|
|
comp.name = c |
|
|
basic.componentHandling.comps[c] = comp |
|
|
cm.comps[c] = comp |
|
|
print(" ---------- test_headlines") |
|
|
print(" ---------- test_headlines") |
|
|
report = self.getReport() |
|
|
report = self.getReport() |
|
|
html = report.getTestcaseHead("TC0001") |
|
|
html = report.getTestcaseHead("TC0001") |
|
@ -125,9 +162,15 @@ class MyTestCase(unittest.TestCase): |
|
|
print(html) |
|
|
print(html) |
|
|
html = report.getArtefactBlock("TC0001", "comp02", "arte01") |
|
|
html = report.getArtefactBlock("TC0001", "comp02", "arte01") |
|
|
print(html) |
|
|
print(html) |
|
|
|
|
|
MyTestCase.mymsg += "\n----- "+actfunction+" : "+str(cnttest) |
|
|
|
|
|
|
|
|
def xtest_reportS(self): |
|
|
def test_30reportS(self): |
|
|
job = basic.program.Job.getInstance() |
|
|
global mymsg |
|
|
|
|
|
actfunction = str(inspect.currentframe().f_code.co_name) |
|
|
|
|
|
cnttest = 0 |
|
|
|
|
|
if actfunction not in TEST_FUNCTIONS: |
|
|
|
|
|
return |
|
|
|
|
|
job = test.testtools.getJob() |
|
|
setattr(job.par, "testcase", "TC0001") |
|
|
setattr(job.par, "testcase", "TC0001") |
|
|
setattr(job.par, "testcases", ["TC0001", "TC0002"]) |
|
|
setattr(job.par, "testcases", ["TC0001", "TC0002"]) |
|
|
setattr(job.par, "tctime", "2022-03-23_21-23-32") |
|
|
setattr(job.par, "tctime", "2022-03-23_21-23-32") |
|
@ -136,11 +179,11 @@ class MyTestCase(unittest.TestCase): |
|
|
cm = basic.componentHandling.ComponentManager() |
|
|
cm = basic.componentHandling.ComponentManager() |
|
|
for compname in ["comp01", "comp02"]: |
|
|
for compname in ["comp01", "comp02"]: |
|
|
conf = {} |
|
|
conf = {} |
|
|
comp = components.component.Component() |
|
|
comp = basic.component.Component() |
|
|
comp.files = { "A": "/home/match/pre.csv", "B": "/home/match/post.csv"} |
|
|
comp.files = { "A": "/home/match/pre.csv", "B": "/home/match/post.csv"} |
|
|
comp.name = compname |
|
|
comp.name = compname |
|
|
comp.conf = conf |
|
|
comp.conf = conf |
|
|
basic.componentHandling.comps[compname] = comp |
|
|
cm.comps[compname] = comp |
|
|
html_1 = report.reportTestcase("TC0001") |
|
|
html_1 = report.reportTestcase("TC0001") |
|
|
print(html_1) |
|
|
print(html_1) |
|
|
print("<<---------------------------------- TC0001") |
|
|
print("<<---------------------------------- TC0001") |
|
@ -154,8 +197,13 @@ class MyTestCase(unittest.TestCase): |
|
|
setattr(job.par, B.PAR_TESTCASES, ["TC0001", "TC0002"]) |
|
|
setattr(job.par, B.PAR_TESTCASES, ["TC0001", "TC0002"]) |
|
|
#html = report.reportTestsuite() |
|
|
#html = report.reportTestsuite() |
|
|
#print(html) |
|
|
#print(html) |
|
|
|
|
|
MyTestCase.mymsg += "\n----- "+actfunction+" : "+str(cnttest) |
|
|
print("<<---------------------------------- TST001") |
|
|
print("<<---------------------------------- TST001") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_zzz(self): |
|
|
|
|
|
print(MyTestCase.mymsg) |
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
if __name__ == '__main__': |
|
|
unittest.main() |
|
|
unittest.main() |
|
|
|
|
|
|
|
|