This repository has been archived by the owner on Jan 9, 2019. It is now read-only.
forked from ci-reporter/ci_reporter
/
cucumber.rb
65 lines (51 loc) · 1.42 KB
/
cucumber.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# (c) Copyright 2006-2009 Nick Sieger <nicksieger@gmail.com>
# See the file LICENSE.txt included with the distribution for
# software license details.
require 'ci/reporter/core'
tried_gem = false
begin
require 'cucumber'
require 'cucumber/formatter/progress'
require 'cucumber/formatter/pretty'
rescue LoadError
unless tried_gem
tried_gem = true
require 'rubygems'
gem 'cucumber'
retry
end
end
module CI
module Reporter
class Cucumber < ::Cucumber::Formatter::Progress
attr_accessor :test_suite, :report_manager, :feature_name
def initialize(*args, &block)
self.report_manager = ReportManager.new("cucumber")
super
end
def visit_feature_name(name)
self.feature_name = name.split("\n").first
super
end
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
def visit_step(step)
test_case = TestCase.new(step.name)
test_case.start
return_value = super
test_case.finish
test_suite.testcases << test_case
return_value
end
end
class CucumberDoc < ::Cucumber::Formatter::Pretty
end
end
end