Skip to content

Commit

Permalink
Updates for Cucumber master (0.4.3.pre) tree walking
Browse files Browse the repository at this point in the history
  • Loading branch information
brynary committed Oct 20, 2009
1 parent 2a74539 commit d8a0865
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 30 deletions.
31 changes: 20 additions & 11 deletions lib/testjour/cucumber_extensions/http_formatter.rb
Expand Up @@ -10,32 +10,41 @@ class HttpFormatter
def before_multiline_arg(multiline_arg) def before_multiline_arg(multiline_arg)
@multiline_arg = true @multiline_arg = true
end end

def after_multiline_arg(multiline_arg) def after_multiline_arg(multiline_arg)
@multiline_arg = false @multiline_arg = false
end end


def before_step(step) def before_step(step)
@step_start = Time.now @step_start = Time.now
end end


def after_step(step) def after_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background)
if step.respond_to?(:status) progress(Time.now - @step_start, status, step_match, exception)
progress(Time.now - @step_start, step) end
end
def before_outline_table(outline_table)
@outline_table = outline_table
end

def after_outline_table(outline_table)
@outline_table = nil
end end


def table_cell_value(value, status) def table_cell_value(value, status)
if (status != :skipped_param) && !@multiline_arg return unless @outline_table
progress(0.0, nil, status) progress(0.0, status) unless table_header_cell?(status)
end
end end


private private


def progress(time, step_invocation, status = nil) def progress(time, status, step_match = nil, exception = nil)
queue = RedisQueue.new queue = RedisQueue.new
queue.push(:results, Result.new(time, step_invocation, status)) queue.push(:results, Result.new(time, status, step_match, exception))
end

def table_header_cell?(status)
status == :skipped_param
end end


end end
Expand Down
24 changes: 18 additions & 6 deletions lib/testjour/cucumber_extensions/step_counter.rb
Expand Up @@ -9,21 +9,33 @@ def initialize
@backtrace_lines = [] @backtrace_lines = []
end end


def before_step(step_invocation) def after_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background)
if step_invocation.respond_to?(:status) #&& step_invocation.status != :outline @backtrace_lines << step_match.backtrace_line
@backtrace_lines << step_invocation.backtrace_line end
end
def before_outline_table(outline_table)
@outline_table = outline_table
end

def after_outline_table(outline_table)
@outline_table = nil
end end


def table_cell_value(value, status) def table_cell_value(value, status)
# Testjour.logger.info "#{value.inspect}, #{status.inspect}" return unless @outline_table
@backtrace_lines << "Table cell value: #{value}" unless status == :skipped_param @backtrace_lines << "Table cell value: #{value}" unless table_header_cell?(status)
end end


def count def count
@backtrace_lines.size @backtrace_lines.size
end end


private

def table_header_cell?(status)
status == :skipped_param
end

end end


end end
24 changes: 11 additions & 13 deletions lib/testjour/result.rb
Expand Up @@ -18,19 +18,17 @@ class Result
:skipped => 'S' :skipped => 'S'
} }


def initialize(time, step_invocation, status = nil) def initialize(time, status, step_match = nil, exception = nil)
@time = time @time = time

@status = status
if status
@status = status if step_match
else @backtrace_line = step_match.backtrace_line
@status = step_invocation.status end
@backtrace_line = step_invocation.backtrace_line

if exception
if step_invocation.exception @message = exception.message.to_s
@message = step_invocation.exception.message.to_s @backtrace = exception.backtrace.join("\n")
@backtrace = step_invocation.exception.backtrace.join("\n")
end
end end


@pid = $PID @pid = $PID
Expand Down

0 comments on commit d8a0865

Please sign in to comment.