class Syskit::GUI::Testing::SubprocessItem
Constants
- COLORS
- FAILED_BACKGROUND
- NEW_SLAVE_BACKGROUND
- RUNNING_BACKGROUND
- SKIP_BACKGROUND
- SLAVE_OBJECT_ID_ROLE
- SLAVE_PID_ROLE
- SUCCESS_BACKGROUND
- TestResult
Attributes
assertions_count[R]
exceptions[R]
failure_count[R]
name[R]
skip_count[R]
slave[R]
slave_exit_status[R]
start_time[R]
test_results[R]
total_run_count[R]
Public Class Methods
html_color(name)
click to toggle source
# File lib/syskit/gui/testing.rb, line 331 def self.html_color(name) color = COLORS[name] "rgb(%i,%i,%i)" % [color.red, color.green, color.blue] end
new(app, slave)
click to toggle source
Calls superclass method
# File lib/syskit/gui/testing.rb, line 361 def initialize(app, slave) super() clear @has_tested = false @executed = false @slave = slave @total_run_count = 0 name = (slave.name[:path] || "Robot: #{app.robot_name}") if base_path = app.find_base_path_for(name) base_path = base_path.to_s name = File.basename(base_path) + ":" + name[(base_path.size + 1)..-1] end @name = name self.text = name self.background = Qt::Brush.new(Qt::Color.new(NEW_SLAVE_BACKGROUND)) end
Public Instance Methods
add_exception(e)
click to toggle source
# File lib/syskit/gui/testing.rb, line 512 def add_exception(e) exceptions << e update_text end
add_test_result(file, test_case_name, test_name, failures, assertions, time)
click to toggle source
# File lib/syskit/gui/testing.rb, line 497 def add_test_result(file, test_case_name, test_name, failures, assertions, time) skip_count, failure_count = 0, 0 failures.each do |e| if e.kind_of?(Minitest::Skip) skip_count += 1 else failure_count += 1 end end @skip_count += skip_count @failure_count += failure_count @assertions_count += assertions test_results << TestResult.new(file, test_case_name, test_name, skip_count, failure_count, failures, assertions, time) update_text end
clear()
click to toggle source
# File lib/syskit/gui/testing.rb, line 517 def clear @failure_count = 0 @skip_count = 0 @assertions_count = 0 @test_results = Array.new @exceptions = Array.new end
discovery_finished()
click to toggle source
# File lib/syskit/gui/testing.rb, line 466 def discovery_finished end
discovery_start()
click to toggle source
# File lib/syskit/gui/testing.rb, line 463 def discovery_start end
each_test_result(&block)
click to toggle source
# File lib/syskit/gui/testing.rb, line 381 def each_test_result(&block) test_results.each(&block) end
exception_count()
click to toggle source
The count of exceptions
# File lib/syskit/gui/testing.rb, line 359 def exception_count; exceptions.size end
executed?()
click to toggle source
# File lib/syskit/gui/testing.rb, line 401 def executed? @executed end
finished(slave_exit_status)
click to toggle source
# File lib/syskit/gui/testing.rb, line 428 def finished(slave_exit_status) @slave_exit_status = slave_exit_status @runtime = runtime if has_failures? || has_exceptions? || slave_failed? self.background = Qt::Brush.new(Qt::Color.new(FAILED_BACKGROUND)) elsif has_skips? self.background = Qt::Brush.new(Qt::Color.new(SKIP_BACKGROUND)) elsif has_tested? self.background = Qt::Brush.new(Qt::Color.new(SUCCESS_BACKGROUND)) else self.background = Qt::Brush.new(Qt::Color.new(NEW_SLAVE_BACKGROUND)) end update_text end
finished?()
click to toggle source
# File lib/syskit/gui/testing.rb, line 405 def finished? !!@runtime end
has_exceptions?()
click to toggle source
# File lib/syskit/gui/testing.rb, line 489 def has_exceptions? !exceptions.empty? end
has_failures?()
click to toggle source
# File lib/syskit/gui/testing.rb, line 485 def has_failures? failure_count > 0 end
has_skips?()
click to toggle source
# File lib/syskit/gui/testing.rb, line 481 def has_skips? skip_count > 0 end
has_tested?()
click to toggle source
# File lib/syskit/gui/testing.rb, line 493 def has_tested? @has_tested end
pending()
click to toggle source
# File lib/syskit/gui/testing.rb, line 397 def pending self.background = Qt::Brush.new(Qt::Color.new(NEW_SLAVE_BACKGROUND)) end
run_count()
click to toggle source
# File lib/syskit/gui/testing.rb, line 385 def run_count test_results.size end
runtime()
click to toggle source
# File lib/syskit/gui/testing.rb, line 420 def runtime if @runtime @runtime elsif start_time Time.now - start_time end end
slave_failed?()
click to toggle source
# File lib/syskit/gui/testing.rb, line 477 def slave_failed? slave_exit_status && !slave_exit_status.success? end
slave_pid(pid)
click to toggle source
# File lib/syskit/gui/testing.rb, line 393 def slave_pid(pid) data(SLAVE_PID_ROLE).to_int end
slave_pid=(pid)
click to toggle source
# File lib/syskit/gui/testing.rb, line 389 def slave_pid=(pid) set_data(Qt::Variant.new(pid), SLAVE_PID_ROLE) end
start()
click to toggle source
# File lib/syskit/gui/testing.rb, line 409 def start @total_run_count += 1 @start_time = Time.now @runtime = nil @executed = true @slave_exit_status = nil self.background = Qt::Brush.new(Qt::Color.new(RUNNING_BACKGROUND)) clear update_text end
status_text()
click to toggle source
# File lib/syskit/gui/testing.rb, line 443 def status_text text = [] if has_tested? text << "#{test_results.size} runs, #{exception_count} exceptions, #{failure_count} failures and #{assertions_count} assertions" end if slave_exit_status && !slave_exit_status.success? if slave_exit_status.signaled? text << "Test process terminated with signal #{slave_exit_status.termsig}" elsif slave_exit_status.exitstatus != 1 || !has_tested? || (exception_count == 0 && failure_count == 0) text << "Test process finished with exit code #{slave_exit_status.exitstatus}" end end text end
test_finished()
click to toggle source
# File lib/syskit/gui/testing.rb, line 474 def test_finished end
test_start()
click to toggle source
# File lib/syskit/gui/testing.rb, line 469 def test_start @has_tested = true update_text end
update_text()
click to toggle source
# File lib/syskit/gui/testing.rb, line 459 def update_text self.text = ([name] + status_text).join("\n") end