def parseSpecCases(spec): specCases = [] for c in spec["cases"]: if c.find('*') >= 0: s = c.replace('.', '\.').replace('*', '.*') p = re.compile(s) t = [] for x in CasesIndices.keys(): if p.match(x): t.append(caseIdtoIdTuple(x)) for h in sorted(t): specCases.append(caseIdTupletoId(h)) else: specCases.append(c) return specCases
def resolveCasePatternList(patterns): """ Return list of test cases that match against a list of case patterns. """ specCases = [] for c in patterns: if c.find("*") >= 0: s = c.replace(".", "\.").replace("*", ".*") p = re.compile(s) t = [] for x in CasesIndices.keys(): if p.match(x): t.append(caseIdtoIdTuple(x)) for h in sorted(t): specCases.append(caseIdTupletoId(h)) else: specCases.append(c) return specCases
def __init__(self, spec, debug = False, outdir = "reports/servers"): WebSocketClientFactory.__init__(self, debug = debug) FuzzingFactory.__init__(self, debug = debug, outdir = outdir) self.spec = spec self.specCases = [] for c in self.spec["cases"]: if c.find('*') >= 0: s = c.replace('.', '\.').replace('*', '.*') p = re.compile(s) t = [] for x in CasesIndices.keys(): if p.match(x): t.append(caseIdtoIdTuple(x)) for h in sorted(t): self.specCases.append(caseIdTupletoId(h)) else: self.specCases.append(c) print "Ok, will run %d test cases against %d servers" % (len(self.specCases), len(spec["servers"])) self.currServer = -1 if self.nextServer(): if self.nextCase(): reactor.connectTCP(self.hostname, self.port, self)