Generating a test case Start Selenium IDE in Firefox by selecting Tools > Selenium IDE, a browser pop-up opens with the Selenium IDE. Selenium IDE records interactions with the Web application, with one command per line. By default, the IDE starts with recording switched on, so when you have completed your web activity you just have to click on the red button on the IDE menu to stop the recording.
To start Selenium IDE goto Tools > Selenium IDE in Firefox browser. Give the base URL of the web application for which you want to create the test case.
To start recording, enter th e web application's path in the browser's address bar, ie http://localhost:8080/ PcqContacts and then start the web activity. Fill in the Contacts form and submit the form. Next, check the Contacts page to see whether that entry has been enlisted. Note, whatever you're doing within the browser is being recorded by the IDE. During recording, Selenium IDE will automatically insert commands into your test case based on your actions. Typically, these include:
Selenium Core can be used to run test suites on other browsers. Through the control Panel frame you can execute the test suites passed on the Test Suite frame.
Clicking a link - 'click' or 'clickAndWait' commands
Entering values - 'type' command
Selecting options from a drop-down listbox - 'select' command
Clicking checkboxes or radio buttons - 'click' command
When you're done with our web activity, simply end the recording by clicking on the IDE's red button on the toolbar. You'll notice in the Table tab that for each activity, there has been a command inserted with a target and value. For instance, when we entered the name as Tyra, the command issued was 'type' with target being 'Name' and value being 'Tyra'.
In the Source tab, you can see the HTML code for the test case generated. Through File > Save Test Case option, save the test case as PcqTestCase.html. Now you can use this test case again to run the case scenario of entering the test values to check that the web form acts normally. To run the test, select the test case from the Test Case frame and then click on Run button from the toolbar of the IDE. This will execute the test within the browser and when any error occurs, it gets reported in the log window.
Adding verification We have already created a test case named PcqTestCase.html. Now if you want to check properties of the web page, use the 'assert' and 'verify' commands. Suppose you want to check that the entered name, Tyra, is present in the Contact list page or not. For that, open the test case in the Selenium IDE and click at the blank line in the Table tab. From the drop-down list, select 'assertTextPresent' command and give its value as Tyra. At test re-run, if the Tyra word is present the assertTextPresent command will return value as true, else it will give an error exception.
Creating test suites As Selenium is available as a core feature with which tests can be executed in other browsers, to deploy Selenium Core, extract the contents of selenium-core-1.0.1.zip to a base folder. Now copy the 'core' folder from the extracted contents into the web accessible directory of your web server. For instance, if you are using Apache web server, then copy 'core' folder into the 'htdocs' folder of the server so that the Selenium Core is available on the same host and same port as your web application.
To create a test suite from Selenium IDE, select the test cases from the Test Case frame and goto File > Save Test Suite As option and enter the name as PcqTestSuite.html. This will create a table formatted html page having references of all test cases that the test suite contains.
To run a test suite from a browser other than Firefox, open the path to the TestRunner.html file, which in Apache's case would be http://localhost/core/ TestRunner.html. For a sample website hosted on the same web server, run the test suite PcqTestSuite.html for that site. In the Test Suite frame, pass the path for the PcqTestSuite.html and then from the Control Panel frame run the test suite. It executes the test cases from the test suite and displays the error log in a separate browser window.
Get most out of your technology infrastructure investments with Dell
About CIOL | Media Kit | Site Map | Contact Us | Help | Write to us | Jobs@CyberMedia | Privacy Policy
Copyright © CyberMedia India Online Ltd. All rights reserved. Usage of content from web site is subject to Terms and Conditions.