1 use Test::More tests => 1;
4 use Catalyst::Engine::HTTP;
5 use File::Temp qw/ tempdir tmpnam /;
8 use lib "$Bin/TestApp/lib";
10 use Test::WWW::Mechanize;
12 my $dir = tempdir(); # CLEANUP => 1 );
13 my $devnull = File::Spec->devnull;
15 my $server_path = File::Spec->catfile('script', 'testapp_server.pl');
16 my $port = int(rand(10000)) + 40000; # get random port between 40000-50000
18 my $childpid = fork();
19 die "fork() error, cannot continue" unless defined($childpid);
22 system("$^X $server_path -p $port > $devnull 2>&1");
23 exit; # just for sure; we should never got here
26 sleep 10; #wait for catalyst application to start
27 my $mech = Test::WWW::Mechanize->new;
28 $mech->get_ok( "http://localhost:" . $port );
30 kill 'KILL', $childpid;