[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Omaha.pm] Test::More SKIP
The SKIP feature of Test::More is pretty slick. I've got a test file in which some tests will only work on one server, other tests will only work on another server, and the rest won't work anywhere.
>From the first server, only the first 19 tests are valid:
bash-2.03$ perl SQLManipulate.t
1..25
ok 1 - new()
ok 2 - rpt_rcmnd...
ok 3 - extent before
ok 4 - extent_size
ok 5 - next_extent_size
ok 6 - manipulate
ok 7 - extent after
ok 8 - d_rate_code...
ok 9 - index before
ok 10 - manipulate
ok 11 - index after
ok 12 - o_bid_adj...
ok 13 - 2 indexes before
ok 14 - manipulate
ok 15 - 2 indexes after
ok 16 - rpt_comp_rates...
ok 17 - index before
ok 18 - manipulate
ok 19 - index after
ok 20 # skip omni-res server tests
ok 21 # skip omni-res server tests
ok 22 # skip omni-res server tests
ok 23 # skip omni-res server tests
ok 24 # skip omni-res server tests
ok 25 # skip omni-res server tests
>From the 2nd server, only test 1 and 21-25 are valid:
(jhannah@omni-res.omnihotels.com) > perl SQLManipulate.t
1..25
ok 1 - new()
ok 2 # skip charm server tests
ok 3 # skip charm server tests
ok 4 # skip charm server tests
ok 5 # skip charm server tests
ok 6 # skip charm server tests
ok 7 # skip charm server tests
ok 8 # skip charm server tests
ok 9 # skip charm server tests
ok 10 # skip charm server tests
ok 11 # skip charm server tests
ok 12 # skip charm server tests
ok 13 # skip charm server tests
ok 14 # skip charm server tests
ok 15 # skip charm server tests
ok 16 # skip charm server tests
ok 17 # skip charm server tests
ok 18 # skip charm server tests
ok 19 # skip charm server tests
ok 20 - smls_bk_codes2...
ok 21 - create index ... using btree before
ok 22 - extent_size
ok 23 - next_extent_size
ok 24 - manipulate
ok 25 - create index ... using btree after
And from this server, only test 1 is valid:
[jhannah@king t]$ perl SQLManipulate.t
1..25
ok 1 - new()
ok 2 # skip charm server tests
ok 3 # skip charm server tests
ok 4 # skip charm server tests
ok 5 # skip charm server tests
ok 6 # skip charm server tests
ok 7 # skip charm server tests
ok 8 # skip charm server tests
ok 9 # skip charm server tests
ok 10 # skip charm server tests
ok 11 # skip charm server tests
ok 12 # skip charm server tests
ok 13 # skip charm server tests
ok 14 # skip charm server tests
ok 15 # skip charm server tests
ok 16 # skip charm server tests
ok 17 # skip charm server tests
ok 18 # skip charm server tests
ok 19 # skip charm server tests
ok 20 # skip omni-res server tests
ok 21 # skip omni-res server tests
ok 22 # skip omni-res server tests
ok 23 # skip omni-res server tests
ok 24 # skip omni-res server tests
ok 25 # skip omni-res server tests
In the .t file, the first server code looks like this:
----------------------
use Sys::Hostname;
my $hostname = hostname;
SKIP: {
skip "charm server tests", 18 unless ($hostname =~ /^charm/);
# all the tests are here...
}
----------------------
Neat,
j