Ulrich Carmesin
3 years ago
13 changed files with 391 additions and 248 deletions
@ -0,0 +1,30 @@ |
|||
# |
|||
# ------------------------------------ |
|||
""" |
|||
a lot of test-results are created dynamically - so these dont belog to the testdata. |
|||
In order to get an overview over the testcases these results should be imported into a database. |
|||
""" |
|||
from datetime import datetime |
|||
import ulrich.message |
|||
import ulrich.program |
|||
import inspect |
|||
import components.component |
|||
|
|||
|
|||
class Catalog(components.component.CompData): |
|||
|
|||
def init_Catalog(self): |
|||
""" |
|||
initialize special tables in the catalog-database |
|||
:return: |
|||
""" |
|||
pass |
|||
|
|||
def check_Instance(self): |
|||
""" |
|||
checks system-instances and writes it into the parameter-file |
|||
""" |
|||
job = ulrich.program.Job.getInstance() |
|||
verify = -1 + job.getDebugLevel(self.name) |
|||
self.m.logInfo("--- " + str(inspect.currentframe().f_code.co_name) + "() started at " + datetime.now().strftime( |
|||
"%Y%m%d_%H%M%S") + " for " + str(self.name).upper()) |
@ -0,0 +1,18 @@ |
|||
# |
|||
# -------------------------------- |
|||
""" |
|||
outside the testrun there are some tasks in order maintain the tests, for example: |
|||
# testrunner to control or execute the testrun |
|||
# set the target-results |
|||
# generate testcases |
|||
# partial cleaning of the storage |
|||
""" |
|||
from datetime import datetime |
|||
import ulrich.message |
|||
import ulrich.program |
|||
import inspect |
|||
import components.component |
|||
|
|||
|
|||
class Maintainer(components.component.CompData): |
|||
pass |
@ -0,0 +1,15 @@ |
|||
# |
|||
# ------------------------------------------------- |
|||
""" |
|||
reporting-applications |
|||
""" |
|||
from datetime import datetime |
|||
import ulrich.message |
|||
import ulrich.program |
|||
import inspect |
|||
import components.component |
|||
|
|||
|
|||
class Report(components.component.CompData): |
|||
|
|||
pass |
@ -0,0 +1,201 @@ |
|||
# abstract class for testrunning-functions |
|||
# --------------------------------------------- |
|||
""" |
|||
The test runs in 3 step: |
|||
1.1 precondition of system |
|||
1.2 test the system |
|||
1.3 postconditions of system incl. comparison |
|||
--- |
|||
The main test is the testcase but there are superior granularities like |
|||
2.a test-sequence : few test-cases depending in a businessflow |
|||
therefore you test a testcase without resetting the system |
|||
2.b test-set : some independing test-cases |
|||
therefore you can test postconditions that works not directly |
|||
2.c test-matrix : a set of test-sets for the whole test |
|||
The granularity could be an implicite parameter in the main-module. |
|||
--- |
|||
the test could be in different test-levels like |
|||
3.a component/service-test |
|||
a quick test to check single functions like in component-test, so you have the possibility to test x-product. |
|||
In difference of developer-test you can run large test-sets |
|||
3.b system-test |
|||
3.c integration-test |
|||
3.d acceptance-test |
|||
the test-level could be a configuration of the test-center or implicite of the application-definition. |
|||
--- |
|||
the test can check different quality-measures like |
|||
4.a functionality |
|||
4.b |
|||
""" |
|||
from datetime import datetime |
|||
import ulrich.message |
|||
import ulrich.program |
|||
import inspect |
|||
import components.component |
|||
|
|||
|
|||
class Testrun(components.component.CompData): |
|||
def prepare_system(self, granularity): |
|||
""" |
|||
In order to preparate the test system test data should be cleaned and loaded with actual data. |
|||
This can happen on different granularities: for each testcase or for each test sequences or for a test set or |
|||
for a whole test. |
|||
The loaded test data should be selected for a later comparison. |
|||
:return: |
|||
""" |
|||
job = ulrich.program.Job.getInstance() |
|||
verify = -1+job.getDebugLevel(self.name) |
|||
self.m.logInfo("--- " + str(inspect.currentframe().f_code.co_name) + "() started at " + datetime.now().strftime("%Y%m%d_%H%M%S") + " for " + str(self.name).upper()) |
|||
|
|||
self.m.setMsg("checkInstance for " + self.name + " is OK") |
|||
self.m.logInfo("--- " + str(inspect.currentframe().f_code.co_name) + "() finished at " + datetime.now().strftime("%Y%m%d_%H%M%S") + " for " + str(self.name).upper()) |
|||
pass |
|||
|
|||
def reset_TData(self, granularity): |
|||
""" |
|||
the testdata in the component of the testsystem will be resetted |
|||
correponding with the configuration of the componend |
|||
:param granularity: |
|||
:return: |
|||
""" |
|||
job = ulrich.program.Job.getInstance() |
|||
verify = -1+job.getDebugLevel(self.name) |
|||
self.m.logDebug(verify, "--- " + str(inspect.currentframe().f_code.co_name) + "() started at " + datetime.now().strftime("%Y%m%d_%H%M%S") + " for " + str(self.name).upper()) |
|||
if "log" in self.conf["artifact"]: |
|||
self.m.logInfo("log rotate in "+ self.name) |
|||
if "db" in self.conf["artifact"]: |
|||
self.m.logInfo("delete db-content "+ self.name) |
|||
if "lob" in self.conf["artifact"]: |
|||
self.m.logInfo("lob is deleted with db "+ self.name) |
|||
if "file" in self.conf["artifact"]: |
|||
self.m.logInfo("rm files in "+ self.name) |
|||
self.m.setMsg("checkInstance for " + self.name + " is OK") |
|||
self.m.logDebug(verify, "--- " + str(inspect.currentframe().f_code.co_name) + "() finished at " + datetime.now().strftime("%Y%m%d_%H%M%S") + " for " + str(self.name).upper()) |
|||
|
|||
def load_TData(self, granularity, testdata): |
|||
""" |
|||
the testdata will be loaded into the componend especially into databses |
|||
or with import-functions of the component |
|||
:param granularity: |
|||
:param testdata: |
|||
:return: |
|||
""" |
|||
job = ulrich.program.Job.getInstance() |
|||
verify = -1+job.getDebugLevel(self.name) |
|||
self.m.logDebug(verify, "--- " + str(inspect.currentframe().f_code.co_name) + "() started at " + datetime.now().strftime("%Y%m%d_%H%M%S") + " for " + str(self.name).upper()) |
|||
if "testdata" in self.conf: |
|||
if self.conf["testdata"] == "db": |
|||
self.m.logInfo("insert db-content " + self.name) |
|||
self.m.setMsg("data loaded for " + self.name + " is OK") |
|||
self.m.logDebug(verify, "--- " + str(inspect.currentframe().f_code.co_name) + "() finished at " + datetime.now().strftime("%Y%m%d_%H%M%S") + " for " + str(self.name).upper()) |
|||
|
|||
def read_TData(self, granularity): |
|||
""" |
|||
|
|||
:param granularity: |
|||
:return: |
|||
""" |
|||
job = ulrich.program.Job.getInstance() |
|||
verify = -1+job.getDebugLevel(self.name) |
|||
self.m.logDebug(verify, "--- " + str(inspect.currentframe().f_code.co_name) + "() started at " + datetime.now().strftime("%Y%m%d_%H%M%S") + " for " + str(self.name).upper()) |
|||
if "db" in self.conf["artifact"]: |
|||
self.m.logInfo("select db-content "+ self.name) |
|||
if "lob" in self.conf["artifact"]: |
|||
self.m.logInfo("check lob if is deleted with db "+ self.name) |
|||
self.m.setMsg("checkInstance for " + self.name + " is OK") |
|||
self.m.logDebug(verify, "--- " + str(inspect.currentframe().f_code.co_name) + "() finished at " + datetime.now().strftime("%Y%m%d_%H%M%S") + " for " + str(self.name).upper()) |
|||
|
|||
def test_System(self, granularity): |
|||
""" |
|||
|
|||
:param granularity: |
|||
:return: |
|||
""" |
|||
def create_Request(self, granularity): |
|||
pass |
|||
def send_Request(self, granularity): |
|||
pass |
|||
def get_Response(self, granularity): |
|||
pass |
|||
|
|||
def finish_Test(self, granularity): |
|||
""" |
|||
initialization-routine for finish-step |
|||
:return: |
|||
""" |
|||
job = ulrich.program.Job.getInstance() |
|||
verify = -1+job.getDebugLevel(self.name) |
|||
self.m.logInfo("--- " + str(inspect.currentframe().f_code.co_name) + "() started at " + datetime.now().strftime("%Y%m%d_%H%M%S") + " for " + str(self.name).upper()) |
|||
self.m.logInfo("something in "+ self.name) |
|||
self.m.setMsg("checkInstance for " + self.name + " is OK") |
|||
self.m.logInfo("--- " + str(inspect.currentframe().f_code.co_name) + "() finished at " + datetime.now().strftime("%Y%m%d_%H%M%S") + " for " + str(self.name).upper()) |
|||
|
|||
def collect_system(self, granularity): |
|||
""" |
|||
After the test the test data of each component should be selected again - to get the post-condition. |
|||
In each component is configured how these data can be collected. |
|||
In this phase the collected data have to be transformed to comparable files. |
|||
:return: |
|||
""" |
|||
pass |
|||
|
|||
def collect_TcArtifact(self, granularity): |
|||
""" |
|||
collects the artifacts from the test-system. |
|||
the result is written as original in subfolder {tcorigin} |
|||
post: a further contact zo the test-system is not necessary |
|||
:return: |
|||
""" |
|||
job = ulrich.program.Job.getInstance() |
|||
verify = job.getDebugLevel(self.name) |
|||
if "log" in self.conf["artifact"]: |
|||
self.m.logInfo("get files in for "+ self.name + " in " + self.conf["artifact"]["log"]["path"]) |
|||
if "db" in self.conf["artifact"]: |
|||
self.m.logInfo("select db-content "+ self.name) |
|||
if "lob" in self.conf["artifact"]: |
|||
pass # after selection get file from db |
|||
if "file" in self.conf["artifact"]: |
|||
self.m.logInfo("get files in for "+ self.name + " in " + self.conf["artifact"]["file"]["path"]) |
|||
|
|||
self.m.debug(verify, "--- " + str(inspect.currentframe().f_code.co_name) + "() " + str(self.name)) |
|||
|
|||
def split_TcResult(self, granularity): |
|||
""" |
|||
transforms the result from subfolder {tcorigin}. |
|||
the result is written as utf-8-readable parts in subfolder {tcparts} |
|||
:return: |
|||
""" |
|||
job = ulrich.program.Job.getInstance() |
|||
verify = job.getDebugLevel(self.name) |
|||
self.m.debug(verify, "--- " + str(inspect.currentframe().f_code.co_name) + "() " + str(self.name)) |
|||
if "log" in self.conf["artifact"]: |
|||
pass # |
|||
if "db" in self.conf["artifact"]: |
|||
pass # stored in table |
|||
if "lob" in self.conf["artifact"]: |
|||
self.m.logInfo("move file from db "+ self.name) |
|||
self.m.logInfo("tidy files in for " + self.name + " in " + self.conf["artifact"]["lob"]["format"]) |
|||
if "file" in self.conf["artifact"]: |
|||
self.m.logInfo("tidy files in for "+ self.name + " in " + self.conf["artifact"]["file"]["format"]) |
|||
|
|||
def fix_TcResult(self, granularity): |
|||
""" |
|||
fixes the result which is collected and transformed from the test-system. |
|||
the result is written in comparable form in folder {tcresult} |
|||
with the identifiable name - like in target |
|||
:return: |
|||
""" |
|||
job = ulrich.program.Job.getInstance() |
|||
verify = job.getDebugLevel(self.name) |
|||
self.m.debug(verify, "--- " + str(inspect.currentframe().f_code.co_name) + "() " + str(self.name)) |
|||
|
|||
def compare_results(self, granularity): |
|||
""" |
|||
to compare the actual result with the target result has three steps: |
|||
1 matching each element so you get a comparable pair |
|||
2 comparing this pair so maybe you get differences |
|||
3 rating the difference if this can be accepted |
|||
:return: |
|||
""" |
|||
pass |
|||
|
Loading…
Reference in new issue