Module: TestReportHandler
Overview
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
TestReportHandler Module
The TestReportHandler (handler) module is intended to be imported into the # TestScriptRunnable (runnable) class. The handler instantiates a # TestReportBuilder (builder) object tailored to the parent runnable instance. # In executing a runnable, calls (i.e. ‘Pass’, ‘Fail’) are made to the handler # module – which then directs the builder instance to update its report # accordingly. Think of the handler as the ‘API’ to interact with the # TestReport output by the execution of a runnable. Each time the runnable is # executed, it instantiates a new builder instance, using the initial builder # as a template. #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Defined Under Namespace
Classes: TestReportBuilder
Instance Method Summary
collapse
Instance Method Details
#builder_template ⇒ Object
36
37
38
|
# File 'lib/testscript_engine/testreport_handler.rb', line 36
def builder_template
@builder_template ||= TestReportBuilder.new(script)
end
|
#cascade_skips(number_to_skip) ⇒ Object
66
67
68
69
70
71
|
# File 'lib/testscript_engine/testreport_handler.rb', line 66
def cascade_skips(number_to_skip)
while number_to_skip > 0
report_builder.skip
number_to_skip -= 1
end
end
|
#error(message = nil) ⇒ Object
57
58
59
|
# File 'lib/testscript_engine/testreport_handler.rb', line 57
def error(message = nil)
report_builder.error(message)
end
|
#fail(message = nil) ⇒ Object
45
46
47
|
# File 'lib/testscript_engine/testreport_handler.rb', line 45
def fail(message = nil)
report_builder.fail(message)
end
|
#finalize_report ⇒ Object
61
62
63
64
|
# File 'lib/testscript_engine/testreport_handler.rb', line 61
def finalize_report
report_builder.finalize_report
testreport
end
|
#fresh_builder ⇒ Object
32
33
34
|
# File 'lib/testscript_engine/testreport_handler.rb', line 32
def fresh_builder
builder_template.clone
end
|
#fresh_testreport ⇒ Object
24
25
26
|
# File 'lib/testscript_engine/testreport_handler.rb', line 24
def fresh_testreport
@report_builder = nil
end
|
#pass(message = nil) ⇒ Object
41
42
43
|
# File 'lib/testscript_engine/testreport_handler.rb', line 41
def pass(message = nil)
report_builder.pass
end
|
#report_builder ⇒ Object
28
29
30
|
# File 'lib/testscript_engine/testreport_handler.rb', line 28
def report_builder
@report_builder ||= fresh_builder
end
|
#script ⇒ Object
A ‘script’ method ought to be defined in the klass that includes the handler - if ‘script’ is undefined, this feeds an empty testscript to the builder
76
77
78
79
80
81
82
|
# File 'lib/testscript_engine/testreport_handler.rb', line 76
def script
begin
super
rescue NoMethodError
FHIR::TestScript.new
end
end
|
#skip(message = nil) ⇒ Object
49
50
51
|
# File 'lib/testscript_engine/testreport_handler.rb', line 49
def skip(message = nil)
report_builder.skip(message)
end
|
#testreport ⇒ Object
20
21
22
|
# File 'lib/testscript_engine/testreport_handler.rb', line 20
def testreport
report_builder.report
end
|
#warning(message = nil) ⇒ Object
53
54
55
|
# File 'lib/testscript_engine/testreport_handler.rb', line 53
def warning(message = nil)
report_builder.warning(message)
end
|