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.
 
 
 

114 lines
3.3 KiB

#!/usr/bin/python
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------------------------------------
# Author : Ulrich Carmesin
# Source : gitea.ucarmesin.de
# ---------------------------------------------------------------------------------------------------------
import os
import basic.program
import basic.catalog
import utils.config_tool
import basic.constants as B
import basic.toolHandling
import utils.data_const as D
import utils.file_tool
import utils.path_tool
"""
# TODO Beschreibung file-tools
* fileXml_tool
* fileJson_tool
* fileYaml_tool
* fileCsv_tool
* fileHtml_tool
...
"""
class FileFcts():
"""
this is an abstract class
"""
def __init__(self):
pass
def setComp(self, job, comp=None):
self.job = job
self.comp = comp
def parseText(self, text):
"""
this function parses the text and translates it to dict
:param text:
:return:
"""
def file2dict(self):
pass
# Funktionen
#=== init_testcase ===
def removeFiles(self):
utils.file_tool.removeFiles(self.comp.m, "envpath", "pattern", self.comp.conf["conn"])
def copyFiles(self):
fileList = []
srcpath = ""
envpath = ""
pattern = ""
utils.file_tool.copyFiles(self.job, fileList, srcpath, envpath, pattern)
def readEnvFiles(self):
envpath = ""
pattern = ""
fileList = utils.file_tool.getFiles(self.comp.m, envpath, pattern, self.comp.conf["conn"])
# === execute_testcase ===
def create_request(self, tdata, step):
mapping = ""
schema = ""
archivpath = ""
filename = step.args["filename"]
txt = ""
for o in self.comp.conf[B.SUBJECT_ARTS][B.TOPIC_NODE_FILE]:
if o["name"] != filename:
continue
mapping = o["mapping"]
schema = o["schema"]
archivpath = os.path.join(utils.path_tool.composePattern("{tcresult}/request", self.comp), filename) # ergebnisse/comp/request )
#txt = self.createDict()
utils.file_tool.writeFileText(self.comp.m, archivpath, txt)
def send_request(self, step):
archivpath = ""
filename = step.args["filename"]
technique = step.args["technique"]
archivpath = os.path.join(utils.path_tool.composePattern("{tcresult}/request", self.comp), filename)
if technique == "cli":
for o in self.comp.conf[B.SUBJECT_ARTS][B.TOPIC_NODE_FILE]:
if o["name"] != filename:
continue
envpath = o["envpath"]
envpath = utils.path_tool.composePattern(envpath, self.comp)
fct = basic.toolHandling.getCliTool(self.comp)
fct.copy(self.job, archivpath, envpath)
elif technique == "api":
txt = utils.file_tool.readFileText(archivpath, self.comp.m)
fct = basic.toolHandling.getApiTool(self.comp)
response = fct.send(self.job, self.comp, txt)
archivpath = os.path.join(utils.path_tool.composePattern("{tcresult}/response", self.comp), filename)
"""
get_response:
- channel (sync/async)
... implement
- archivpath ( ergebnisse/comp/response )
- envpath ( ./log) / envconn ( = in Request empfangen )
=== collect_testcase ===
- envpath
- pattern
> readfiles
"""