Sha256: 40a363eaa61d2af6c720007bbe09730cb594e151993b1b1890e60f0bbbb777b1
Contents?: true
Size: 1.51 KB
Versions: 5
Compression:
Stored size: 1.51 KB
Contents
require 'test/unit' require 'watir/assertions' module Watir class TestCase < Test::Unit::TestCase include Watir::Assertions @@order = :sequentially def initialize name throw :invalid_test if name == :default_test && self.class == Watir::TestCase super end class << self attr_accessor :test_methods, :order def test_methods @test_methods ||= [] end def order @order || @@order end def default_order= order @@order = order end def sorted_test_methods case order when :alphabetically: test_methods.sort when :sequentially: test_methods when :reversed_sequentially: test_methods.reverse when :reversed_alphabetically: test_methods.sort.reverse else raise ArgumentError, "Execute option not supported: #{@order}" end end def suite suite = Test::Unit::TestSuite.new(name) sorted_test_methods.each do |test| catch :invalid_test do suite << new(test) end end if (suite.empty?) catch :invalid_test do suite << new(:default_test) end end return suite end def method_added id name = id.id2name test_methods << name if name =~ /^test./ end def execute order @order = order end end public :add_assertion end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
watir-1.5.4 | watir/testcase.rb |
watir-1.5.3 | watir/testcase.rb |
watir-1.5.2 | watir/testcase.rb |
watir-1.5.6 | watir/testcase.rb |
watir-1.5.5 | watir/testcase.rb |