Class: Roby::App::Rake::RobotTestTask
- Inherits:
-
BaseTestTask
- Object
- Rake::TaskLib
- BaseTestTask
- Roby::App::Rake::RobotTestTask
- Defined in:
- lib/roby/app/rake.rb
Overview
Rake task to run the Roby tests
To use, add the following to your Rakefile:
require 'roby/app/rake'
Roby::App::Rake::TestTask.new
It create a test task per robot configuration, named “test:$#robot_name”. It also creates a test:all-robots task that runs each robot’s configuration in sequence. You can inspect these tasks with
rake --tasks
and call them with e.g.
rake test:default
The test:all-robots task will fail only at the end of all tests, reporting which configuration actually failed. To stop at the first failure, pass a ‘0’ as argument, e.g.
rake 'test:all-robots[0]'
Finally, the ‘test:all’ target runs syskit test –all (i.e. runs all tests in the default robot configuration)
The ‘test’ target points by default to test:all-robots. See below to change this.
The following examples show how to fine-tune the creates tests:
Defined Under Namespace
Classes: Failed
Instance Attribute Summary collapse
-
#robot_name ⇒ Object
Returns the value of attribute robot_name.
-
#robot_type ⇒ Object
Returns the value of attribute robot_type.
Attributes inherited from BaseTestTask
#app, #base_dir, #config, #excludes, #force_discovery, #report_dir, #self_only, #task_name, #test_files, #ui
Instance Method Summary collapse
- #define ⇒ Object
-
#initialize(task_name = "test", robot_name:, robot_type: nil) {|_self| ... } ⇒ RobotTestTask
constructor
A new instance of RobotTestTask.
Methods inherited from BaseTestTask
#coverage?, #force_discovery?, #keep_logs?, #read_captured_output_from_pipe, #run_roby, #run_roby_test, #self_only?, #spawn_process, #spawn_process_capturing_output, #ui?, #use_junit?, #wait_process_with_captured_output, #write_captured_output
Constructor Details
#initialize(task_name = "test", robot_name:, robot_type: nil) {|_self| ... } ⇒ RobotTestTask
Returns a new instance of RobotTestTask.
600 601 602 603 604 605 606 607 |
# File 'lib/roby/app/rake.rb', line 600 def initialize(task_name = "test", robot_name:, robot_type: nil) super(task_name) @robot_name = robot_name @robot_type = robot_type || robot_name yield self if block_given? define end |
Instance Attribute Details
#robot_name ⇒ Object
Returns the value of attribute robot_name.
598 599 600 |
# File 'lib/roby/app/rake.rb', line 598 def robot_name @robot_name end |
#robot_type ⇒ Object
Returns the value of attribute robot_type.
598 599 600 |
# File 'lib/roby/app/rake.rb', line 598 def robot_type @robot_type end |
Instance Method Details
#define ⇒ Object
611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 |
# File 'lib/roby/app/rake.rb', line 611 def define test_args = %i[keep_going synchronize_output omit_tests_success] desc "run the tests for configuration #{robot_name}:#{robot_type}" task task_name, test_args do |t, args| synchronize_output = args.fetch(:synchronize_output, "0") == "1" omit_tests_success = args.fetch(:omit_tests_success, "0") == "1" result = run_roby_test( "-r", "#{robot_name},#{robot_type}", coverage_name: task_name, report_name: "#{robot_name}:#{robot_type}", synchronize_output: synchronize_output, omit_success: omit_tests_success ) unless result raise Failed.new("failed to run tests for "\ "#{robot_name}:#{robot_type}"), "tests failed" end end end |