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.
19 20 21 22 23 24 25 26 |
# File 'lib/roby/app/test_reporter.rb', line 19 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.
14 15 16 |
# File 'lib/roby/app/test_reporter.rb', line 14 def manager @manager end |
#pid ⇒ Object (readonly)
Returns the value of attribute pid.
14 15 16 |
# File 'lib/roby/app/test_reporter.rb', line 14 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.
14 15 16 |
# File 'lib/roby/app/test_reporter.rb', line 14 def slave_name @slave_name end |
Instance Method Details
#discovery_finished ⇒ Object
37 38 39 |
# File 'lib/roby/app/test_reporter.rb', line 37 def discovery_finished server.discovery_finished(pid) end |
#discovery_start ⇒ Object
33 34 35 |
# File 'lib/roby/app/test_reporter.rb', line 33 def discovery_start server.discovery_start(pid) end |
#exception(e) ⇒ Object
28 29 30 31 |
# File 'lib/roby/app/test_reporter.rb', line 28 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
46 47 48 49 |
# File 'lib/roby/app/test_reporter.rb', line 46 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
52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/roby/app/test_reporter.rb', line 52 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
67 68 69 |
# File 'lib/roby/app/test_reporter.rb', line 67 def test_finished server.test_finished(pid) end |
#test_start ⇒ Object
41 42 43 |
# File 'lib/roby/app/test_reporter.rb', line 41 def test_start server.test_start(pid) end |