In the previous article "Master Selenium: Selenium IDE - Part-I", we learned how to created how to create a simple test case with Selenium.
In this part we will make it a little bit more complex :).
We will create a test case that will:
1- Opens the Delicious home page.
2- Searches by the keyword 'Selenium'.
3- Reads the number of bookmarks from the result page.
Now, this may not look like a test case for you but it will but it's just an exercise that will surely apply in a real test case.
PREREQUISITES:
Downloading and installing Selenium RC
Selenium RC is a Java based command line server that starts browsers and runs commands you pass from your tests.
1. First make sure you have a Java runtime installed on your machine.
2. Download Selenium RC.
3. After extracting the files from the archive copy the ‘selenium-server.jar’ file to any directory you feel appropriate. I copied it to my PHP installations bin directory.
4. Start the Selenium RC server from the command-line by issuing the following command:
2. Download Selenium RC.
3. After extracting the files from the archive copy the ‘selenium-server.jar’ file to any directory you feel appropriate. I copied it to my PHP installations bin directory.
4. Start the Selenium RC server from the command-line by issuing the following command:
java -jar selenium-server.jar
This will start the server on port 4444.
5. Now the server is ready to accept test commands from your PHP script. Make sure you keep this server running till you finish testing.
Installing PHPUnit
1. An easy way to install PHPUnit is to use the PEAR installer. The PEAR channel (pear.phpunit.de) is used to distribute PHPUnit so make sure that it is registered with your local PEAR environment:
1. An easy way to install PHPUnit is to use the PEAR installer. The PEAR channel (pear.phpunit.de) is used to distribute PHPUnit so make sure that it is registered with your local PEAR environment:
pear channel-discover pear.phpunit.de
After the channel is registered install PHPUnit:
pear install phpunit/PHPUnit