Class: Rproof::XMLReporter
Instance Method Summary
collapse
#report_assertion, #report_exception, #report_warning
Constructor Details
#initialize(xml_pathname:) ⇒ XMLReporter
Returns a new instance of XMLReporter.
13
14
15
|
# File 'lib/rproof/xml_reporter.rb', line 13
def initialize(xml_pathname:)
@xml_pathname = xml_pathname
end
|
Instance Method Details
#assertion_to_xml(assertion, xml_assertion) ⇒ Object
32
33
34
35
36
37
38
39
40
|
# File 'lib/rproof/xml_reporter.rb', line 32
def assertion_to_xml(assertion, xml_assertion)
xml_assertion.file = assertion.file
xml_assertion.line = assertion.line
xml_assertion.method = assertion.method
xml_assertion. = assertion.
xml_assertion.expected = assertion.expected.inspect
xml_assertion.obtained = assertion.obtained.inspect
xml_assertion
end
|
#report_campaign_begin ⇒ Object
17
18
|
# File 'lib/rproof/xml_reporter.rb', line 17
def report_campaign_begin
end
|
#report_campaign_end(test_results, start_time, end_time) ⇒ Object
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/rproof/xml_reporter.rb', line 42
def report_campaign_end(test_results, start_time, end_time)
results = (test_results.is_a? Array) ? test_results.flatten : [test_results]
xml = Builder::XmlMarkup.new(indent: 2)
xml.test_campgain do |xml_campgain|
results.each do |result|
xml_campgain.test_result do |xml_result|
xml_result.name result.name
xml_result.description result.description
xml_result.assertions do |xml_assertions|
result.assertions.each do |assertion|
if assertion.is_successful
xml_assertions.success do |xml_assertion|
xml_assertion = assertion_to_xml(assertion, xml_assertion)
end
else
xml_assertions.failure do |xml_assertion|
xml_assertion = assertion_to_xml(assertion, xml_assertion)
end
end
end
end
xml_result.warnings do |xml_warnings|
result.warnings.each do |warning|
xml_warnings.warning warning.message
end
end
xml_result.exceptions do |xml_exceptions|
result.exceptions.each do |exception|
xml_exceptions.exception do |xml_exception|
xml_exception.message = exception.message
xml_exception.backtrace = exception.backtrace.join("\n")
end
end
end
end
end
end
xml_file = File.open(@xml_pathname, "w")
xml_file << xml.target!
xml_file.close
end
|
#report_suite_begin(id, name, description) ⇒ Object
20
21
|
# File 'lib/rproof/xml_reporter.rb', line 20
def report_suite_begin(id, name, description)
end
|
#report_suite_end(id, test_results) ⇒ Object
29
30
|
# File 'lib/rproof/xml_reporter.rb', line 29
def report_suite_end(id, test_results)
end
|
#report_test_begin(id, name, description) ⇒ Object
23
24
|
# File 'lib/rproof/xml_reporter.rb', line 23
def report_test_begin(id, name, description)
end
|
#report_test_end(id, test_result) ⇒ Object
26
27
|
# File 'lib/rproof/xml_reporter.rb', line 26
def report_test_end(id, test_result)
end
|