Class: DeepTest::Test::SupervisedTestSuite
- Inherits:
-
Object
- Object
- DeepTest::Test::SupervisedTestSuite
- Defined in:
- lib/deep_test/test/supervised_test_suite.rb
Instance Method Summary collapse
- #add_tests(test_suite, tests_by_name) ⇒ Object
-
#initialize(suite, blackboard) ⇒ SupervisedTestSuite
constructor
A new instance of SupervisedTestSuite.
- #read_results(result, tests_by_name) ⇒ Object
- #run(result) {|::Test::Unit::TestSuite::STARTED, @suite.name| ... } ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize(suite, blackboard) ⇒ SupervisedTestSuite
Returns a new instance of SupervisedTestSuite.
4 5 6 7 |
# File 'lib/deep_test/test/supervised_test_suite.rb', line 4 def initialize(suite, blackboard) @suite = suite @blackboard = blackboard end |
Instance Method Details
#add_tests(test_suite, tests_by_name) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/deep_test/test/supervised_test_suite.rb', line 21 def add_tests(test_suite, tests_by_name) if test_suite.respond_to? :tests test_suite.tests.each do |test| add_tests(test, tests_by_name) end else tests_by_name[test_suite.name] = test_suite @blackboard.write_work Test::WorkUnit.new(test_suite) end end |
#read_results(result, tests_by_name) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/deep_test/test/supervised_test_suite.rb', line 32 def read_results(result, tests_by_name) DeepTest.logger.debug("SupervisedTestSuite: going to read #{tests_by_name.size} results") missing_tests = ResultReader.new(@blackboard).read(tests_by_name) do |test, remote_result| remote_result.add_to result yield ::Test::Unit::TestCase::FINISHED, test.name if block_given? end missing_tests.each do |name, test_case| result.add_error ::Test::Unit::Error.new(name, WorkUnitNeverReceivedError.new) end ensure DeepTest.logger.debug("SupervisedTestSuite: exiting with #{missing_tests.size} results left") end |
#run(result) {|::Test::Unit::TestSuite::STARTED, @suite.name| ... } ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/deep_test/test/supervised_test_suite.rb', line 9 def run(result, &progress_block) yield ::Test::Unit::TestSuite::STARTED, @suite.name tests_by_name = {} add_tests @suite, tests_by_name read_results result, tests_by_name, &progress_block yield ::Test::Unit::TestSuite::FINISHED, @suite.name end |
#size ⇒ Object
17 18 19 |
# File 'lib/deep_test/test/supervised_test_suite.rb', line 17 def size @suite.size end |