def addAssert(self, test_info, assertName, varList, exception): BaseReporter.addAssert(self, test_info, assertName, varList, exception) if self.immediate and self.vassert: self._write( "\n " + self._vassertMessage(assertName, varList, exception is None)) self.multiLineOutput = True
def done(self): BaseReporter.done(self) # create result table from reportlab.lib import colors from reportlab.platypus import SimpleDocTemplate, Table, TableStyle table = Table(self.test_data) table.setStyle( TableStyle( [ ("INNERGRID", (0, 0), (-1, -1), 0.25, colors.black), ("BOX", (0, 0), (-1, -1), 0.25, colors.black), ("VALIGN", (0, 0), (-1, -1), "TOP"), ("BACKGROUND", (0, 0), (-1, 0), colors.grey), ] ) ) for i in xrange(1, len(self.test_data)): if self.test_data[i][1] == "Success": color = colors.green else: color = colors.red table.setStyle(TableStyle([("TEXTCOLOR", (1, i), (1, i), color)])) self.lst.append(table) if self.cover_amount != None: self._print_coverage(self.cover_amount, self.coverage) SimpleDocTemplate(self.filename).build(self.lst)
def addSkip(self, test_info, err_info, isRegistered=True): BaseReporter.addSkip(self, test_info, err_info, isRegistered) def add_elements(): self.writer.element("reason", err_info.exception_value()) self._add_testcase_element(test_info, "skip")
def start(self): BaseReporter.start(self) self._pbg = ProgressBarGuiThread( num_tests=self.parameters["num_tests"], ) self._pbg.start() self._pbg.wait_until_ready() if self._pbg.error: raise self._pbg.error[1]
def done(self): BaseReporter.done(self) # TODO: deal with runner.startTime and runner.stopTime runner = get_runner() import datetime runner.stopTime = datetime.datetime.now() self.stream.write(runner.generateReportString(self))
def done(self): BaseReporter.done(self) # TODO: deal with runner.startTime and runner.stopTime runner = get_runner() import datetime runner.stopTime = datetime.datetime.now() self.stream.write( runner.generateReportString(self) )
def __init__(self, filename): BaseReporter.__init__(self) from cStringIO import StringIO self._sio = StringIO() from elementtree.SimpleXMLWriter import XMLWriter self.writer = XMLWriter(self._sio, "utf-8") self.filename = filename self.test_starts = {}
def stopTest(self, test_info): BaseReporter.stopTest(self, test_info) if self.vassert and not self.immediate: self._printVasserts(test_info) if self.time_each_test: self.writers.normal.write(" [%.2f seconds]" % self.current_test_total_time) if self.showAll: self._writeln("")
def done(self): BaseReporter.done(self) self.writer.element("total_time", value="%.4f" % self.total_time) self.writer.end("testsuites") if self.cover_amount is not None and self.cover_amount == "xml": self._write_coverage(self.coverage) self.writer.end("results")
def done(self): BaseReporter.done(self) self.writer.element("total_time", value="%.4f"%self.total_time) self.writer.end("testsuites") if self.cover_amount is not None and self.cover_amount == "xml": self._write_coverage(self.coverage) self.writer.end("results")
def done(self): BaseReporter.done(self) self.writer.end("table") self.writer.element("p", "Total time: %.4f"%self.total_time) self.writer.end("body") self.writer.end("html") #assert len(self.test_starts) == 0 f = file(self.filename, "w") try: f.write(self._getHtml()) finally: f.close()
def stopTest(self, test_info): BaseReporter.stopTest(self, test_info) if self.vassert and not self.immediate: self._printVasserts(test_info) if self.time_each_test: self.writers.normal.write( " [%.2f seconds]" % self.current_test_total_time ) if self.showAll: self._writeln("")
def __init__(self, filename): BaseReporter.__init__(self) from reportlab.platypus import XPreformatted, Spacer self.filename = filename self.lst = [] self.lst.append( XPreformatted( "<b><i><font size=20>Summary of test results</font></i></b>", self._normal_style())) self.lst.append(Spacer(0, 20)) self.test_data = [("Name", "Result", "Info")]
def __init__(self): BaseReporter.__init__(self) from cStringIO import StringIO self._sio = StringIO() try: from elementtree.SimpleXMLWriter import XMLWriter except ImportError: from testoob.compatibility.SimpleXMLWriter import XMLWriter self.writer = XMLWriter(self._sio, "utf-8") self.test_starts = {}
def __init__(self, filename): BaseReporter.__init__(self) from reportlab.platypus import XPreformatted, Spacer self.filename = filename self.lst = [] self.lst.append( XPreformatted("<b><i><font size=20>Summary of test results</font></i></b>", self._normal_style()) ) self.lst.append(Spacer(0, 20)) self.test_data = [("Name", "Result", "Info")]
def done(self): BaseReporter.done(self) self.writer.end("table") self.writer.element("p", "Total time: %.4f" % self.total_time) self.writer.end("body") self.writer.end("html") #assert len(self.test_starts) == 0 f = file(self.filename, "w") try: f.write(self._getHtml()) finally: f.close()
def stopTest(self, test_info): BaseReporter.stopTest(self, test_info) if self.vassert and not self.immediate: self._printVasserts(test_info) if self.time_each_test: self.writers.normal.write( " [%.2f seconds]" % self.current_test_total_time ) # If a test is skipped because of a KeyboardInterrupt, it will be re-run # to make it explicitely skipped. In those cases, you don't want a newline # yet. In all other cases, you'd like to have a newline in verbose mode # to close off the "OK", "SKIPPED", "FAIL", or "ERROR" strings self._write_newline_after_result_if_necessary()
def __init__(self, stream, create_writers = StreamWriters): # TODO - why the hell do we save re? import re self.re = re BaseReporter.__init__(self) self.writers = create_writers(stream) from testoob.reporting import options self.showAll = options.verbosity > 1 self.dots = options.verbosity == 1 self.vassert = options.verbosity == 3 self.immediate = options.immediate self.descriptions = options.descriptions self.time_each_test = options.time_each_test
def __init__(self, stream, create_writers=StreamWriters): # TODO - why the hell do we save re? import re self.re = re BaseReporter.__init__(self) self.writers = create_writers(stream) from testoob.reporting import options self.showAll = options.verbosity > 1 self.dots = options.verbosity == 1 self.vassert = options.verbosity == 3 self.immediate = options.immediate self.descriptions = options.descriptions self.time_each_test = options.time_each_test
def __init__(self, stream): BaseReporter.__init__(self) self.stream = stream self.success_count = 0 self.failure_count = 0 self.error_count = 0 # result is a list of result in 4 tuple # ( # result code (0: success; 1: fail; 2: error), # TestCase object, # Test output (byte string), # stack trace, # ) self.result = []
def addSkip(self, test_info, err_info, isRegistered=True): # addSkip can be called after or before stopTest: # 1) If a testcase is skipped programmatically, addSkip # is called before stopTest, as expected # 2) If a testcase is skipped using keyboard interrupt, # the testcase is rerun with a new decorator that # calls addSkip, causing it to be run after stopTest. # When adding the newline after SKIPPED, this has to be # taken into account. BaseReporter.addSkip(self, test_info, err_info, isRegistered) self._report_result("SKIPPED", "S", self.writers.warning) # newline needed here because newline added in stopTest gets # printed before SKIPPED does, if the root-cause was a # keyboardInterrupt, which can be recognized by an empty # exception value. if err_info.exc_info[2] is None: self._write_newline_after_result_if_necessary()
def done(self): BaseReporter.done(self) if self.dots or self.showAll: self._write("\n") if not self.immediate: self._printErrors() if len(self.skips) > 0: self._printSkipped() if len(self.errors) > 0: self._printShortErrors("Erred", self.errors) if len(self.failures) > 0: self._printShortErrors("Failed", self.failures) self._writeln(self.separator2) self._printResults()
def done(self): BaseReporter.done(self) #create result table from reportlab.lib import colors from reportlab.platypus import SimpleDocTemplate, Table, TableStyle table = Table(self.test_data) table.setStyle( TableStyle([('INNERGRID', (0, 0), (-1, -1), 0.25, colors.black), ('BOX', (0, 0), (-1, -1), 0.25, colors.black), ('VALIGN', (0, 0), (-1, -1), "TOP"), ('BACKGROUND', (0, 0), (-1, 0), colors.grey)])) for i in xrange(1, len(self.test_data)): if (self.test_data[i][1] == "Success"): color = colors.green else: color = colors.red table.setStyle(TableStyle([('TEXTCOLOR', (1, i), (1, i), color)])) self.lst.append(table) if (self.cover_amount != None): self._print_coverage(self.cover_amount, self.coverage) SimpleDocTemplate(self.filename).build(self.lst)
def addAssert(self, test_info, assertName, varList, exception): BaseReporter.addAssert(self, test_info, assertName, varList, exception) if self.immediate and self.vassert: self._write("\n " + self._vassertMessage(assertName, varList, exception is None)) self.multiLineOutput = True
def start(self): BaseReporter.start(self) self._writeHeader()
def startTest(self, test_info): BaseReporter.startTest(self, test_info) self.test_starts[test_info] = time.time()
def addFailure(self, test_info, err_info): BaseReporter.addFailure(self, test_info, err_info) self._add_unsuccessful_testcase("failure", test_info, err_info)
def start(self): BaseReporter.start(self) self.writer.start("results") self.writer.start("testsuites")
def addSkip(self, test_info, err_info, isRegistered=True): # TODO: why does addSkip get called _after_ stopTest? BaseReporter.addSkip(self, test_info, err_info, isRegistered) # newline needed because newline added in stopTest gets printed before # SKIPPED does self._report_result("SKIPPED\n", "S", self.writers.warning)
def startTest(self, test_info): BaseReporter.startTest(self, test_info) self.multiLineOutput = False if self.showAll: self._write(self.getDescription(test_info)) self._write(" ... ")
def addError(self, test_info, err_info): BaseReporter.addError(self, test_info, err_info) self.error_count += 1 self.result.append((2, test_info.classname(), '', str(err_info)))
def addSuccess(self, test_info): BaseReporter.addSuccess(self, test_info) self.test_data.append((str(test_info), "Success", ""))
def addSuccess(self, test_info): BaseReporter.addSuccess(self, test_info) self._sio.write(HTMLReporter._SuccessTemplate%(str(test_info), self._test_time(test_info)))
def addError(self, test_info, err_info): BaseReporter.addError(self, test_info, err_info) self._report_failure( "ERROR", "E", self.writers.failure, test_info, err_info)
def addSkip(self, test_info, err_info, isRegistered=True): BaseReporter.addSkip(self, test_info, err_info, isRegistered) self._sio.write(HTMLReporter._SkipTemplate % (str(test_info), self._test_time(test_info), str(err_info.exception_value())))
def addSuccess(self, test_info): BaseReporter.addSuccess(self, test_info) self._sio.write(HTMLReporter._SuccessTemplate % (str(test_info), self._test_time(test_info)))
def addSkip(self, test_info, err_info, isRegistered=True): BaseReporter.addSkip(self, test_info, err_info, isRegistered) def add_elements(): self.writer.element( "reason", err_info.exception_value() ) self._add_testcase_element(test_info, "skip")
def addSuccess(self, test_info): BaseReporter.addSuccess(self, test_info) self._report_result("OK", ".", self.writers.success)
def addSuccess(self, test_info): BaseReporter.addSuccess(self, test_info) self.success_count += 1 self.result.append((0, test_info.classname(), '', ''))
def addError(self, test_info, err_info): BaseReporter.addError(self, test_info, err_info) self._add_unsuccessful_testcase("error", test_info, err_info)
def addFailure(self, test_info, err_info): BaseReporter.addFailure(self, test_info.classname(), err_info) self.failure_count += 1 self.result.append((1, test_info.classname(), '', str(err_info)))
def addSuccess(self, test_info): BaseReporter.addSuccess(self, test_info) self._add_testcase_element(test_info, "success")
def addError(self, test_info, err_info): BaseReporter.addError(self, test_info, err_info) self._report_failure("ERROR", "E", self.writers.failure, test_info, err_info)
def addFailure(self, test_info, err_info): BaseReporter.addFailure(self, test_info, err_info) self._report_failure("FAIL", "F", self.writers.failure, test_info, err_info)
def addSkip(self, test_info, err_info, isRegistered=True): BaseReporter.addSkip(self, test_info, err_info, isRegistered) self._sio.write(HTMLReporter._SkipTemplate%(str(test_info), self._test_time(test_info), str(err_info.exception_value())))
def addFailure(self, test_info, err_info): BaseReporter.addFailure(self, test_info, err_info) self._report_failure( "FAIL", "F", self.writers.failure, test_info, err_info)