Class: Roby::App::TestReporter
Overview
Minitest reporter for a client/server scheme in autotest
Note that the idea and a big chunk of the implementation has been taken from the minitest-server plugin. The main differences is that it accounts for load errors (exceptions that happen outside of minitest itself) and is using DRoby’s marshalling for exceptions
Instance Attribute Summary collapse
-
#manager ⇒ Object
readonly
Returns the value of attribute manager.
-
#pid ⇒ Object
readonly
Returns the value of attribute pid.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
-
#slave_name ⇒ Object
readonly
Returns the value of attribute slave_name.
Instance Method Summary collapse
- #discovery_finished ⇒ Object
- #discovery_start ⇒ Object
- #exception(e) ⇒ Object
-
#initialize(pid, slave_name, server_pid, manager: DRoby::Marshal.new) ⇒ TestReporter
constructor
A new instance of TestReporter.
-
#prerecord(klass, method_name) ⇒ Object
This method is part of the minitest API.
-
#record(result) ⇒ Object
This method is part of the minitest API …
- #test_finished ⇒ Object
- #test_start ⇒ Object
Constructor Details
#initialize(pid, slave_name, server_pid, manager: DRoby::Marshal.new) ⇒ TestReporter
Returns a new instance of TestReporter.
20 21 22 23 24 25 26 27 |
# File 'lib/roby/app/test_reporter.rb', line 20 def initialize(pid, slave_name, server_pid, manager: DRoby::Marshal.new) @pid = pid @slave_name = slave_name uri = TestServer.path(server_pid) @server = DRbObject.new_with_uri uri @manager = manager super() end |
Instance Attribute Details
#manager ⇒ Object (readonly)
Returns the value of attribute manager.
15 16 17 |
# File 'lib/roby/app/test_reporter.rb', line 15 def manager @manager end |
#pid ⇒ Object (readonly)
Returns the value of attribute pid.
12 13 14 |
# File 'lib/roby/app/test_reporter.rb', line 12 def pid @pid end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
14 15 16 |
# File 'lib/roby/app/test_reporter.rb', line 14 def server @server end |
#slave_name ⇒ Object (readonly)
Returns the value of attribute slave_name.
13 14 15 |
# File 'lib/roby/app/test_reporter.rb', line 13 def slave_name @slave_name end |
Instance Method Details
#discovery_finished ⇒ Object
38 39 40 |
# File 'lib/roby/app/test_reporter.rb', line 38 def discovery_finished server.discovery_finished(pid) end |
#discovery_start ⇒ Object
34 35 36 |
# File 'lib/roby/app/test_reporter.rb', line 34 def discovery_start server.discovery_start(pid) end |
#exception(e) ⇒ Object
29 30 31 32 |
# File 'lib/roby/app/test_reporter.rb', line 29 def exception(e) @has_failures = true server.exception(pid, manager.dump(e)) end |
#prerecord(klass, method_name) ⇒ Object
This method is part of the minitest API
47 48 49 50 |
# File 'lib/roby/app/test_reporter.rb', line 47 def prerecord(klass, method_name) file, = klass.instance_method(method_name).source_location server.test_method(pid, file, klass.name, method_name) end |
#record(result) ⇒ Object
This method is part of the minitest API … cannot change its name
53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/roby/app/test_reporter.rb', line 53 def record(result) r = result if r.respond_to?(:source_location) # Minitest 3.11+ class_name = r.klass file, = r.source_location else c = r.class file, = c.instance_method(r.name).source_location class_name = c.name end failures = manager.dump(r.failures) @has_failures ||= r.failures.any? { |e| !e.kind_of?(Minitest::Skip) } server.test_result(pid, file, class_name, r.name, failures, r.assertions, r.time) end |
#test_finished ⇒ Object
68 69 70 |
# File 'lib/roby/app/test_reporter.rb', line 68 def test_finished server.test_finished(pid) end |
#test_start ⇒ Object
42 43 44 |
# File 'lib/roby/app/test_reporter.rb', line 42 def test_start server.test_start(pid) end |