I have a test harness set up with a series of Selenium test scripts. Each script tests a specific scenario on my web site. But I have some scenarios that I want to test multiple times with different data entered each time. Currently I am using environment parameters to pass the test data into each script. But that doesn't work for multiple passes, since I have no way to save the base data and restore it after modifying it.
Since I'm stuck with MS-Windows, the test suite is run from a batch file like so: ------8<------------------------------- @echo off REM This script sets a number of environment parameters, then runs all of the Perl REM test scripts in the Tests/ directory. REM First we set some basic parameters set MMID_BROWSER=firefox set MMID_SITE=tst11.dev set MMID_BUILD=0044_00 set mmid_user=devmmi...@tpsmail.dev set MMID_PWD=password1 set MMID_FIRSTNAME=James set MMID_LASTNAME=Smith set MMID_USID=146702 REM Then run all of the Perl test scripts in the Tests directory. perl -MTest::Harness -e "@ARGV= map glob, @ARGV if $^O =~ /^MSWin/; runtests @ARGV;" Tests/*.pl ------8<------------------------------- Each test script starts out something like this: ------8<------------------------------- use strict; use warnings; use Time::HiRes qw(sleep); use Test::WWW::Selenium; use Test::More tests => 24; use Test::Exception; use Env; my $browser = $ENV{'MMID_BROWSER'}; my $site = $ENV{'MMID_SITE'}; my $build = $ENV{'MMID_BUILD'}; my $user = $ENV{'MMID_USER'}; my $pwd = $ENV{'MMID_PWD'}; my $sel = Test::WWW::Selenium->new( host => "localhost", port => 4444, browser => "*$browser", browser_url => "http://$site.example.com/" ); $sel->open_ok("http://$site.example.com/"); $sel->set_speed("500"); sleep 5; cmp_ok ($sel->get_text("css=div[id=footerNarrow]"), "=~", $build, "Correct build number") or BAIL_OUT("Build number doesn't match!"); like($sel->get_title(), qr/ - Login/, "Login page"); $sel->type_ok("LoginID", "$user"); $sel->type_ok("LoginPWD", "$pwd"); $sel->click_ok("LoginSubmit"); $sel->wait_for_page_to_load_ok("10000"); ------8<------------------------------- Is there a cleaner way to pass those variables into each test script? How can I make this loop through some tests multiple times with different sets of data each time? Is there a better forum for these questions? Thank you, Bob McConnell -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/