class Roby::App::TestReporter

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

Attributes

manager[R]
pid[R]
server[R]
slave_name[R]

Public Class Methods

new(pid, slave_name, server_pid, manager: DRoby::Marshal.new) click to toggle source
Calls superclass method
# 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

Public Instance Methods

discovery_finished() click to toggle source
# File lib/roby/app/test_reporter.rb, line 38
def discovery_finished
    server.discovery_finished(pid)
end
discovery_start() click to toggle source
# File lib/roby/app/test_reporter.rb, line 34
def discovery_start
    server.discovery_start(pid)
end
exception(e) click to toggle source
# 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) click to toggle source

This method is part of the minitest API

# 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) click to toggle source

This method is part of the minitest API … cannot change its name

# 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() click to toggle source
# File lib/roby/app/test_reporter.rb, line 68
def test_finished
    server.test_finished(pid)
end
test_start() click to toggle source
# File lib/roby/app/test_reporter.rb, line 42
def test_start
    server.test_start(pid)
end