[Wtr-general] How to make sure that script run in linesquencerather than alphabetical sequence when using load
Cain, Mark
Mark_Cain at RL.gov
Thu Mar 8 09:42:40 EST 2007
I ran into this irritating behavior a while back and it appears that ruby ASCII sorts the test methods before execution. I solved it by putting 01, 02, 03, ... after 'test' (test01, test02, etc) and then the test would run in the order I put them in.
---------------------------------------------------------------------------
require 'watir/testcase'
class TC2_Sequential < Watir::TestCase
def test01_b;
load 'rt/rt_r_login.rb';
print 'E';
end
def test02_a;
load 'rt/rt_w_login.rb'
print 'F';
end
def test03_d;
load 'rt/rt_r_system_admin_nameserver.rb'
print 'G';
end
def test04_c;
load 'rt/rt_w_system_admin_nameserver.rb'
print 'H';
end
end
---------------------------------------------------------------------------
Hope this helps,
--Mark
________________________________
From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of Jason He
Sent: Thursday, March 08, 2007 1:22 AM
To: wtr-general at rubyforge.org
Subject: Re: [Wtr-general] How to make sure that script run in linesquencerather than alphabetical sequence when using load
Yes, give the class name with suffix “Sequence” can make sure the code executing sequence according to line number in the script.
However, it seems that code in the other script won’t execute when “load” method is embraced in the class/function block.
---------------------------------------------------------------------------
require 'watir/testcase'
class TC2_Sequential < Watir::TestCase
def test_b;
load 'rt/rt_r_login.rb';
print 'E';
end
def test_a;
load 'rt/rt_w_login.rb'
print 'F';
end
def test_d;
load 'rt/rt_r_system_admin_nameserver.rb'
print 'G';
end
def test_c;
load 'rt/rt_w_system_admin_nameserver.rb'
print 'H';
end
end
---------------------------------------------------------------------------
The output as follow,
---------------------------------------------------------------------------
C:¥watir1145>test.rb
Loaded suite C:/watir1145/test
Started
E.F.G.H.
Finished in 0.0 seconds.
4 tests, 0 assertions, 0 failures, 0 errors
---------------------------------------------------------------------------
Is there anything I missed?
Regards,
Jason
________________________________
From: wtr-general-bounces at rubyforge.org [mailto:wtr-general-bounces at rubyforge.org] On Behalf Of ?eljko Filipin
Sent: 2007年3月7日 19:19
To: wtr-general at rubyforge.org
Subject: Re: [Wtr-general] How to make sure that script run in line squencerather than alphabetical sequence when using load
Maybe this will help.
http://wiki.openqa.org/display/WTR/Test-Unit+Patch
--
Zeljko Filipin
zeljkofilipin.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070308/dd1ca323/attachment-0001.html
More information about the Wtr-general
mailing list