Esempio n. 1
0
class MTConst:
    beginTestCaseInfo = "\t%s Running ..."
    endTestCaseInfo = "%s:\t%s"

    equalInfo = "Assert %sEqual, in fact %sEqual: Expected \"%s\", Actual \"%s\" for \"%s\""
    conditionInfo = "Assert %s, in fact %s for %s"
    containInfo = "Contains %s for %s: %s should be contained in: %s"
    jsonContainInfo = "JSON %scontained, for %s:\n%s"

    sysFunReg = PyRegExp('__.+__|BeginTestCase|EndTestCase|SetUp|TearDown|Property|Assert|Logger')
    exceptReg = PyRegExp(".*driver[a-z|A-Z|]*.py|.*casemodel[a-z|A-Z|]*.py")

    passed = 0
    warned = 1
    failed = 2
    notRun = 3
Esempio n. 2
0
    def init(self, runMode='debug', tcPattern=None, outTcPattern=None, searchKey=None,
             logFilePath=None):
        try:
            self.runMode = self.runModeEnum[runMode]
        except:
            self.runMode = self.runModeEnum['debug']
        self.searchKey = searchKey
        self.tcReg = PyRegExp(tcPattern) if tcPattern != None and tcPattern != "" else None
        self.tcRegOutScope = PyRegExp(outTcPattern) if outTcPattern != None and outTcPattern != "" else None
        self.isModeling = False

        logManager.removeHandler(slog, 1)
        logManager.addFileHandler(slog, None, "mtest.log")  # set syslog for test

        if str(logFilePath).strip().endswith(".html"):
            from tmodel.model.logreport import HtmlTestReport
            self.tlog.registerLogger(HtmlTestReport, logFilePath, False)
            self.tlog.registerLogger(TestLogger, "testlog.log")
        else:
            self.tlog.registerLogger(TestLogger, logFilePath)
Esempio n. 3
0
    def setRunCase(self,
                   tcPattern=None,
                   outTcPattern=None,
                   searchKey=None,
                   runMode=None,
                   isclearresult=False):
        self.tcReg = PyRegExp(
            tcPattern) if tcPattern != None and tcPattern != "" else None
        self.tcRegOutScope = PyRegExp(
            outTcPattern
        ) if outTcPattern != None and outTcPattern != "" else None
        self.searchKey = None if searchKey is None or searchKey == "" else searchKey.replace(
            ",", " ").split()

        if runMode is not None:
            try:
                self.runMode = self.runModeEnum[runMode]
            except:
                self.runMode = self.runModeEnum['debug']
        if isclearresult:
            self.tcInfos.clear()