why not just add to the maddness if its already there?
[catagits/Catalyst-Runtime.git] / t / optional_stress.t
CommitLineData
c7ded7aa 1#!perl
2
3use strict;
4use warnings;
5
4853fb50 6use Test::More;
7BEGIN {
8 plan skip_all => 'set TEST_STRESS to enable this test'
9 unless $ENV{TEST_STRESS};
10}
11
c7ded7aa 12use FindBin;
13use lib "$FindBin::Bin/lib";
c7ded7aa 14use Catalyst::Test 'TestApp';
c7ded7aa 15
16our ( $iters, $tests );
17
18BEGIN {
15f0ede8 19 eval "use YAML";
20 plan skip_all => 'YAML is required for this test' if $@;
21
c7ded7aa 22 $iters = $ENV{TEST_STRESS} || 10;
23 $tests = YAML::LoadFile("$FindBin::Bin/optional_stress.yml");
24
25 my $total_tests = 0;
26 map { $total_tests += scalar @{ $tests->{$_} } } keys %{$tests};
27 plan tests => $iters * $total_tests;
28}
29
30for ( 1 .. $iters ) {
31 run_tests();
32}
33
34sub run_tests {
35 foreach my $test_group ( keys %{$tests} ) {
36 foreach my $test ( @{ $tests->{$test_group} } ) {
37 ok( request($test), $test_group . ' - ' . $test );
38 }
39 }
40}