Class: CI::Reporter::Cucumber
- Inherits:
-
Object
- Object
- CI::Reporter::Cucumber
- Defined in:
- lib/ci/reporter/cucumber.rb,
lib/ci/reporter/cucumber/version.rb
Constant Summary collapse
- VERSION =
"1.0.0"
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#report_manager ⇒ Object
Returns the value of attribute report_manager.
-
#test_suite ⇒ Object
Returns the value of attribute test_suite.
Instance Method Summary collapse
- #after_background(*args) ⇒ Object
- #after_examples(*args) ⇒ Object
- #after_feature(feature) ⇒ Object
- #after_steps(steps) ⇒ Object
- #after_table_row(table_row) ⇒ Object
- #before_background(*args) ⇒ Object
- #before_examples(*args) ⇒ Object
- #before_feature(feature) ⇒ Object
- #before_steps(steps) ⇒ Object
- #before_table_row(table_row) ⇒ Object
- #feature_name(keyword, name) ⇒ Object
-
#initialize(step_mother, io, options) ⇒ Cucumber
constructor
A new instance of Cucumber.
- #scenario_name(keyword, name, *args) ⇒ Object
Constructor Details
#initialize(step_mother, io, options) ⇒ Cucumber
Returns a new instance of Cucumber.
41 42 43 |
# File 'lib/ci/reporter/cucumber.rb', line 41 def initialize(step_mother, io, ) @report_manager = ReportManager.new("features") end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
39 40 41 |
# File 'lib/ci/reporter/cucumber.rb', line 39 def name @name end |
#report_manager ⇒ Object
Returns the value of attribute report_manager.
39 40 41 |
# File 'lib/ci/reporter/cucumber.rb', line 39 def report_manager @report_manager end |
#test_suite ⇒ Object
Returns the value of attribute test_suite.
39 40 41 |
# File 'lib/ci/reporter/cucumber.rb', line 39 def test_suite @test_suite end |
Instance Method Details
#after_background(*args) ⇒ Object
60 61 |
# File 'lib/ci/reporter/cucumber.rb', line 60 def after_background(*args) end |
#after_examples(*args) ⇒ Object
96 97 |
# File 'lib/ci/reporter/cucumber.rb', line 96 def after_examples(*args) end |
#after_feature(feature) ⇒ Object
50 51 52 53 54 55 |
# File 'lib/ci/reporter/cucumber.rb', line 50 def after_feature(feature) test_suite.name = @name test_suite.finish report_manager.write_report(@test_suite) @test_suite = nil end |
#after_steps(steps) ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/ci/reporter/cucumber.rb', line 76 def after_steps(steps) @test_case.finish case steps.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(steps) end test_suite.testcases << @test_case @test_case = nil end |
#after_table_row(table_row) ⇒ Object
109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/ci/reporter/cucumber.rb', line 109 def after_table_row(table_row) if @header_row @header_row = false return end @test_case.finish if table_row.respond_to? :failed? @test_case.failures << CucumberFailure.new(table_row) if table_row.failed? test_suite.testcases << @test_case @test_case = nil end end |
#before_background(*args) ⇒ Object
57 58 |
# File 'lib/ci/reporter/cucumber.rb', line 57 def before_background(*args) end |
#before_examples(*args) ⇒ Object
92 93 94 |
# File 'lib/ci/reporter/cucumber.rb', line 92 def before_examples(*args) @header_row = true end |
#before_feature(feature) ⇒ Object
45 46 47 48 |
# File 'lib/ci/reporter/cucumber.rb', line 45 def before_feature(feature) self.test_suite = TestSuite.new(@name) test_suite.start end |
#before_steps(steps) ⇒ Object
71 72 73 74 |
# File 'lib/ci/reporter/cucumber.rb', line 71 def before_steps(steps) @test_case = TestCase.new(@scenario) @test_case.start end |
#before_table_row(table_row) ⇒ Object
99 100 101 102 103 104 105 106 107 |
# File 'lib/ci/reporter/cucumber.rb', line 99 def before_table_row(table_row) row = table_row # shorthand for table_row # check multiple versions of the row and try to find the best fit outline = (row.respond_to? :name) ? row.name : (row.respond_to? :scenario_outline) ? row.scenario_outline : row.to_s @test_case = TestCase.new("#@scenario (outline: #{outline})") @test_case.start end |
#feature_name(keyword, name) ⇒ Object
63 64 65 |
# File 'lib/ci/reporter/cucumber.rb', line 63 def feature_name(keyword, name) @name = (name || "Unnamed feature").split("\n").first end |
#scenario_name(keyword, name, *args) ⇒ Object
67 68 69 |
# File 'lib/ci/reporter/cucumber.rb', line 67 def scenario_name(keyword, name, *args) @scenario = (name || "Unnamed scenario").split("\n").first end |