Sha256: ba08892987f6911d9e321aed013a94e0536ece442c9fe8648b2a1b575cc0cd4c

Contents?: true

Size: 1.54 KB

Versions: 42

Compression:

Stored size: 1.54 KB

Contents

# This is an UNFINISHED attempt to run the unit tests currently.
# The work on the harness is complete. 
# The problem remaining is that the tests are not thread-safe.
# It's an open question whether getting this to work would actually save any execution time.

TOPDIR = File.join(File.dirname(__FILE__), '..')
$LOAD_PATH.unshift TOPDIR
Dir.chdir TOPDIR
#(Dir["unittests/*_test.rb"] - ["unittests/popups_test.rb"]).each {|x| require x}

require 'unittests/buttons_test'
require 'unittests/checkbox_test'

require 'test/unit/testsuite'
require 'thread'
class ConcurrentTestSuite < Test::Unit::TestSuite
  
  # Runs the tests and/or suites contained in this TestSuite.
  def run(result, &progress_block)
    yield(STARTED, name)
    threads = []
    @tests.each do |test|
      threads << Thread.new do
        test.run(result, &progress_block)
      end
    end
    threads.each {|t| t.join}
    yield(FINISHED, name)
  end
end

# create a suite
require 'test/unit/collector/objectspace'

require 'test/unit/collector'
include Test::Unit::Collector


@filters = []
suite = ConcurrentTestSuite.new('super suite')
sub_suites = []
::ObjectSpace.each_object(Class) do |klass|
  if(Test::Unit::TestCase > klass)
    puts sub_suites, klass.suite
    add_suite(sub_suites, klass.suite)
  end
end
sort(sub_suites).each{|s| suite << s}



# select a runner
require 'test/unit/ui/console/testrunner'
Test::Unit::UI::Console::TestRunner.run(suite)


# then subclass Test::Unit::TestSuite and override the run method to be multithreaded

Version data entries

42 entries across 42 versions & 2 rubygems

Version Path
watir-classic-3.0.0 unittests/other/all_tests_concurrent.rb
watir-3.0.0.rc3 unittests/other/all_tests_concurrent.rb
watir-3.0.0.rc2 unittests/other/all_tests_concurrent.rb
watir-3.0.0.rc1 unittests/other/all_tests_concurrent.rb
watir-2.0.4 unittests/other/all_tests_concurrent.rb
watir-2.0.3 unittests/other/all_tests_concurrent.rb
watir-2.0.2 unittests/other/all_tests_concurrent.rb
watir-2.0.2.rc1 unittests/other/all_tests_concurrent.rb
watir-2.0.1 unittests/other/all_tests_concurrent.rb
watir-2.0.0 unittests/other/all_tests_concurrent.rb
watir-2.0.0.rc3 unittests/other/all_tests_concurrent.rb
watir-2.0.0.rc2 unittests/other/all_tests_concurrent.rb
watir-1.9.2 unittests/other/all_tests_concurrent.rb
watir-1.9.2.rc1 unittests/other/all_tests_concurrent.rb
watir-1.9.1 unittests/other/all_tests_concurrent.rb
watir-1.9.1.rc1 unittests/other/all_tests_concurrent.rb
watir-1.9.0 unittests/other/all_tests_concurrent.rb
watir-1.9.0.rc7 unittests/other/all_tests_concurrent.rb
watir-1.9.0.rc6 unittests/other/all_tests_concurrent.rb
watir-1.9.0.rc5 unittests/other/all_tests_concurrent.rb