示例#1
0
                self.wrt("FAILED")
            else:
                self.wrt("ERROR")
        self.wrt("\n")

    def print_stacktrace(self, step):
        if not step.display:
            return

        if step.failed:
            print_spaced = lambda x: self.wrt("%s%s\n" % (" " * step.indentation, x))

            for line in step.why.traceback.splitlines():
                print_spaced(line)

reporter = NameReporter()

after.each_scenario(reporter.print_scenario_ran)
after.each_step(reporter.store_failed_step)
after.each_step(reporter.print_stacktrace)
after.all(reporter.print_end)


def print_no_features_found(where):
    where = core.fs.relpath(where)
    if not where.startswith(os.sep):
        where = '.%s%s' % (os.sep, where)

    reporter.wrt('Oops!\n')
    reporter.wrt('could not find features at %s\n' % where)
示例#2
0
from lettuce.terrain import after
from lettuce.terrain import before
from lettuce.plugins.reporter import Reporter

class DotReporter(Reporter):
    def print_scenario_ran(self, scenario):
        if scenario.passed:
            self.wrt(".")
        elif scenario.failed:
            reason = self.scenarios_and_its_fails[scenario]
            if isinstance(reason.exception, AssertionError):
                self.wrt("F")
            else:
                self.wrt("E")

reporter = DotReporter()

before.each_scenario(reporter.print_scenario_running, name='output')
after.each_scenario(reporter.print_scenario_ran, name='output')
after.each_step(reporter.store_failed_step, name='output')
after.all(reporter.print_end, name='output')


def print_no_features_found(where):
    where = core.fs.relpath(where)
    if not where.startswith(os.sep):
        where = '.%s%s' % (os.sep, where)

    reporter.wrt('Oops!\n')
    reporter.wrt('could not find features at %s\n' % where)
示例#3
0
from lettuce.terrain import after
from lettuce.terrain import before
from lettuce.plugins.reporter import Reporter

class DotReporter(Reporter):
    def print_scenario_ran(self, scenario):
        if scenario.passed:
            self.wrt(".")
        elif scenario.failed:
            reason = self.scenarios_and_its_fails[scenario]
            if isinstance(reason.exception, AssertionError):
                self.wrt("F")
            else:
                self.wrt("E")

reporter = DotReporter()

before.each_scenario(reporter.print_scenario_running)
after.each_scenario(reporter.print_scenario_ran)
after.each_step(reporter.store_failed_step)
after.all(reporter.print_end)


def print_no_features_found(where):
    where = core.fs.relpath(where)
    if not where.startswith(os.sep):
        where = '.%s%s' % (os.sep, where)

    reporter.wrt('Oops!\n')
    reporter.wrt('could not find features at %s\n' % where)