Class: CI::Reporter::Cucumber

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(step_mother, io, options) ⇒ Cucumber

Returns a new instance of Cucumber.



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

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

Instance Attribute Details

#feature_nameObject

Returns the value of attribute feature_name.



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

def feature_name
  @feature_name
end

#report_managerObject

Returns the value of attribute report_manager.



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

def report_manager
  @report_manager
end

#test_suiteObject

Returns the value of attribute test_suite.



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

def test_suite
  @test_suite
end

Instance Method Details

#visit_feature_element(feature_element) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/ci/reporter/cucumber.rb', line 63

def visit_feature_element(feature_element)
  self.test_suite = TestSuite.new("#{feature_name} #{feature_element.instance_variable_get("@name")}")
  test_suite.start

  return_value = super

  test_suite.finish
  report_manager.write_report(test_suite)
  self.test_suite = nil

  return_value
end

#visit_feature_name(name) ⇒ Object



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

def visit_feature_name(name)
  self.feature_name = name.split("\n").first
  super
end

#visit_step(step) ⇒ Object



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/ci/reporter/cucumber.rb', line 76

def visit_step(step)
  test_case = TestCase.new(step.name)
  test_case.start

  return_value = super

  test_case.finish

  case step.status
  when :pending, :undefined
    test_case.name = "#{test_case.name} (PENDING)"
  when :skipped
    test_case.name = "#{test_case.name} (SKIPPED)"
  when :failed
    test_case.failures << CucumberFailure.new(step)
  end

  test_suite.testcases << test_case

  return_value
end