Class: CI::Reporter::Cucumber

Inherits:
Object
  • Object
show all
Defined in:
lib/ci/reporter/cucumber.rb

Instance Method Summary collapse

Constructor Details

#initialize(step_mother, io, options) ⇒ Cucumber

Returns a new instance of Cucumber.



50
51
52
# File 'lib/ci/reporter/cucumber.rb', line 50

def initialize(step_mother, io, options)
  @report_manager = ReportManager.new("features")
end

Instance Method Details

#after_feature_element(feature_element) ⇒ Object



71
72
73
74
75
# File 'lib/ci/reporter/cucumber.rb', line 71

def after_feature_element(feature_element)
  @test_case.finish
  @test_case.name = "#{@test_case.name} #{@status}".strip
  @test_suite.testcases << @test_case
end

#after_feature_name(name) ⇒ Object



59
60
61
62
63
# File 'lib/ci/reporter/cucumber.rb', line 59

def after_feature_name(name)
  @test_suite.finish
  @report_manager.write_report(@test_suite)
  @test_suite = nil
end

#after_step(step) ⇒ Object



77
78
79
80
81
82
83
84
85
86
87
# File 'lib/ci/reporter/cucumber.rb', line 77

def after_step(step)
  case step.status
  when :pending, :undefined
    @status = "(PENDING)" if @status.empty?
  when :skipped
    @status = "(SKIPPED)" unless @status == "(FAILED)"
  when :failed
    @status = "(FAILED)"
    @test_case.failures << CucumberFailure.new(step)
  end
end

#before_feature_element(feature_element) ⇒ Object



65
66
67
68
69
# File 'lib/ci/reporter/cucumber.rb', line 65

def before_feature_element(feature_element)
  @test_case = TestCase.new(feature_element.instance_variable_get("@name"))
  @status = ""
  @test_case.start
end

#before_feature_name(name) ⇒ Object



54
55
56
57
# File 'lib/ci/reporter/cucumber.rb', line 54

def before_feature_name(name)        
  @test_suite = TestSuite.new(name.split("\n").first)
  @test_suite.start
end