on command prompt execute perl amazon.pl
C:\Selenium>perl amazon.pl
ok 1 - open, /
ok 2 - type, twotabsearchtextbox, Microscope USB
ok 3 - click, //input[@alt='Go']
ok 4 - wait_for_page_to_load, 30000
ok 5 - is_text_present, Veho
ok 6 - click, link=Veho VMS004DELUXE USB Powered Microscope
ok 7 - wait_for_page_to_load, 300001..7
So here's how it happens
Selenium server waits there & launches the browser
So have a succesful first testcase.
I 'll add more of Data driven approach & executing a test suite.
This blog comprises of learning to get started with Open source automation tools. Mentions best practices of Agile,Xtreme Programming Selenium In nutshell.
Favourite Quote
Wednesday, June 9, 2010
Writing first test case in perl
I created a test script in perl
All it does is gets into amazon.co.uk & searches for a microscope verifies if the brand exists & clicks on that link.
use strict;use warnings;
use Time::HiRes qw(sleep);
use Test::WWW::Selenium;
use Test::More "no_plan";
use Test::Exception;
my $sel = Test::WWW::Selenium->new( host => "localhost",
port => 4444,
browser => "*iexplore",
browser_url => "http://www.amazon.com/" );
$sel->open_ok("/");
$sel->type_ok("twotabsearchtextbox", "Microscope USB");
$sel->click_ok("//input[\@alt='Go']");
$sel->wait_for_page_to_load_ok("30000");
$sel->is_text_present_ok("Veho");
$sel->click_ok("link=Veho VMS004DELUXE USB Powered Microscope");
$sel->wait_for_page_to_load_ok("30000");
All it does is gets into amazon.co.uk & searches for a microscope verifies if the brand exists & clicks on that link.
use strict;use warnings;
use Time::HiRes qw(sleep);
use Test::WWW::Selenium;
use Test::More "no_plan";
use Test::Exception;
my $sel = Test::WWW::Selenium->new( host => "localhost",
port => 4444,
browser => "*iexplore",
browser_url => "http://www.amazon.com/" );
$sel->open_ok("/");
$sel->type_ok("twotabsearchtextbox", "Microscope USB");
$sel->click_ok("//input[\@alt='Go']");
$sel->wait_for_page_to_load_ok("30000");
$sel->is_text_present_ok("Veho");
$sel->click_ok("link=Veho VMS004DELUXE USB Powered Microscope");
$sel->wait_for_page_to_load_ok("30000");
Easy steps to go with installing Selenium RC for Perl
These steps are specific to Windows Box.I am on Win XP
1.Start your Selenium server
You can create a batch file as below & just double click with start the server
add java -jar selenium-server.jar to a file & name that as seleniumserver.bat
2. Download Active Perl
3.Now you gotto install Test-WWW-Selenium packages.
4.Invoke perl package manager from your command prompt like this ppm
5.A GUI will open up search for Test-WWW
once you locate the selenium package on the list Run the marked actions.
So you are all set with the selenium packages that are required for you to get going.
1.Start your Selenium server
You can create a batch file as below & just double click with start the server
add java -jar selenium-server.jar to a file & name that as seleniumserver.bat
2. Download Active Perl
3.Now you gotto install Test-WWW-Selenium packages.
4.Invoke perl package manager from your command prompt like this ppm
5.A GUI will open up search for Test-WWW
once you locate the selenium package on the list Run the marked actions.
So you are all set with the selenium packages that are required for you to get going.
Subscribe to:
Posts (Atom)