示例#1
0
    def result(self, step_result):
        text = u'%6s %s ... ' % (step_result.keyword, step_result.name)
        self.msg.progressMessage(text)
        
        if self.current_scenario.status == "untested":
            return

        if self.current_scenario.status == "passed":
            self.msg.message('testFinished', name=self.current_scenario.name,
                             duration=str(self.current_scenario.duration), flowId=None)

        if self.current_scenario.status == "failed":
            name = step_result.name

            error_msg = u"Step failed: {}".format(name)
            if self.current_step.table:
                table = ModelDescriptor.describe_table(self.current_step.table, None)
                error_msg = u"{}\nTable:\n{}".format(error_msg, table)

            if self.current_step.text:
                text = ModelDescriptor.describe_docstring(self.current_step.text, None)
                error_msg = u"{}\nText:\n{}".format(error_msg, text)

            error_details = step_result.error_message

            self.msg.testFailed(self.current_scenario.name, message=error_msg, details=error_details)
            self.msg.message('testFinished', name=self.current_scenario.name,
                             duration=str(self.current_scenario.duration), flowId=None)
示例#2
0
    def result(self, step_result):
        if self.current_scenario.status == "untested":
            return

        if self.current_scenario.status == "passed":
            self.msg.message('testFinished',
                             name=self.current_scenario.name,
                             duration=str(self.current_scenario.duration),
                             flowId=None)

        if self.current_scenario.status == "failed":
            name = self.current_step.name

            error_msg = u"Step failed: {}".format(name)
            if self.current_step.table:
                table = ModelDescriptor.describe_table(self.current_step.table,
                                                       None)
                error_msg = u"{}\nTable:\n{}".format(error_msg, table)

            if self.current_step.text:
                text = ModelDescriptor.describe_docstring(
                    self.current_step.text, None)
                error_msg = u"{}\nText:\n{}".format(error_msg, text)

            error_details = step_result.error_message

            self.msg.testFailed(self.current_scenario.name,
                                message=error_msg,
                                details=error_details)
            self.msg.message('testFinished',
                             name=self.current_scenario.name,
                             duration=str(self.current_scenario.duration),
                             flowId=None)
示例#3
0
def step_to_text(step, indentation="    "):
    step_text = u"%s %s" % (step.keyword, step.name)
    more_text = None
    if step.text:
        more_text = ModelDescriptor.describe_docstring(step.text, indentation)
    elif step.table:
        more_text = ModelDescriptor.describe_table(step.table, indentation)
    if more_text:
        step_text = u"%s\n%s" % (step_text, more_text)
    return step_text.rstrip()
示例#4
0
文件: junit.py 项目: florentx/behave
 def describe_step(cls, step):
     status = str(step.status)
     if cls.show_timings:
         status += u" in %0.3fs" % step.duration
     text  = u'%s %s ... ' % (step.keyword, step.name)
     text += u'%s\n' % status
     if cls.show_multiline:
         prefix = make_indentation(2)
         if step.text:
             text += ModelDescriptor.describe_docstring(step.text, prefix)
         elif step.table:
             text += ModelDescriptor.describe_table(step.table, prefix)
     return text
示例#5
0
 def describe_step(self, step):
     status_text = _text(step.status.name)
     if self.show_timings:
         status_text += " in %0.3fs" % step.duration
     text = '%s %s ... ' % (step.keyword, step.name)
     text += '%s\n' % status_text
     if self.show_multiline:
         prefix = make_indentation(2)
         if step.text:
             text += ModelDescriptor.describe_docstring(step.text, prefix)
         elif step.table:
             text += ModelDescriptor.describe_table(step.table, prefix)
     return text
示例#6
0
文件: junit.py 项目: xbx/behave
 def describe_step(cls, step):
     status = str(step.status)
     if cls.show_timings:
         status += u" in %0.3fs" % step.duration
     text  = u'%s %s ... ' % (step.keyword, step.name)
     text += u'%s\n' % status
     if cls.show_multiline:
         prefix = make_indentation(2)
         if step.text:
             text += ModelDescriptor.describe_docstring(step.text, prefix)
         elif step.table:
             text += ModelDescriptor.describe_table(step.table, prefix)
     return text
示例#7
0
 def print_docstring(self, docstring):
     indentation = self.indentations[self.INDENT_MULTILINE]
     text = ModelDescriptor.describe_docstring(docstring, indentation)
     self.writer.write(text, style="docstring")
     self.writer.flush()
     # self.step_lines += len(docstring.splitlines()) + 2
     # self.step_lines += text.count("\n")
     self.step_lines += self.calculate_terminal_lines(text)
示例#8
0
 def print_docstring(self, docstring):
     indentation = self.indentations[self.INDENT_MULTILINE]
     text = ModelDescriptor.describe_docstring(docstring, indentation)
     self.writer.write(text, style="docstring")
     self.writer.flush()
     # self.step_lines += len(docstring.splitlines()) + 2
     # self.step_lines += text.count("\n")
     self.step_lines += self.calculate_terminal_lines(text)
示例#9
0
 def print_table(self, table):
     indentation = self.indentations[self.INDENT_MULTILINE]
     text = ModelDescriptor.describe_table(table, indentation)
     self.writer.write(text, style="table")
     self.writer.flush()
     self.step_lines += len(table.rows) + 1
示例#10
0
 def print_table(self, table):
     indentation = self.indentations[self.INDENT_MULTILINE]
     text = ModelDescriptor.describe_table(table, indentation)
     self.writer.write(text, style="table")
     self.writer.flush()
     self.step_lines += len(table.rows) + 1
示例#11
0
def step_impl(context):
    rendered_table = ModelDescriptor.describe_table(context.table, "    ")
    context.execute_steps(
        """given a set of processors in the \"{cluster_name}\" flow
        {table}
        """.format(cluster_name="primary_cluster", table=rendered_table))