Sha256: cda393333b32a942bbd77346a15ead233750906e674e81f47d128bfc904eef17
Contents?: true
Size: 1.53 KB
Versions: 1
Compression:
Stored size: 1.53 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 then test_methods.sort when :sequentially then test_methods when :reversed_sequentially then test_methods.reverse when :reversed_alphabetically then 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
commonwatir-1.6.2 | lib/watir/testcase.rb |