How to do Data Driven Testing using Selenium Ide?

  • Cubettech
  • Web App Development
  • 10 years ago

Selenium IDE is a Firefox plugin which records and plays back user interactions with the browser. By using some extensions we can use this for Data Driven Testing.

Data-driven testing means by using a single test to verify many test cases by driving the test with input and expected values from an external data source instead of using the same hard-coded values each time the test runs.

How to install Selenium ide?

1) Download the latest version.
2) Install the Add-on
3) Restart Firefox
4) After Firefox reboots, the Selenium-IDE will list under the Firefox Tools menu.

Add-on : Sel Blocks
Selenium IDE does not have in-built features to create data-driven tests. By using some user extension or Add-on we can do data driven tests. In this blog ,I am trying to do the data driven test with an Add-on called Sel Blocks .It provides various flow control elements such as conditional handling, looping, variables and data-driven testing in Selenium IDE tests.

How to do test driven Testing

Download and install the Add-on SelBlocks.

2)Creating an XML file.
In this, we are importing the test data from the xml file.

How to create an xml file
2.1)Open a note pad
2.2) Write a Declaration Statement
XML declaration statement requires the language and version. This is to establish the page as an XML document.
2.3) Create a Root and child Element
Here we can add as Root element and as the child element. In child element we can define all the parameters needed for the test
2.4) Save the file with extension .xml

<testdata> <vars Email="" Remail="" Password="123456" Rpassword="123456"/> <vars Email="" Remail="" Password="123456" Rpassword="123456"/> <vars Email="" Remail="" Password="123456" Rpassword="123456"/> <vars Email="" Remail="" Password="123456" Rpassword="123456"/> <vars Email="" Remail="" Password="123456" Rpassword="123456"/> </testdata>

3)Create a test scripts  in  IDE.
In this, we are trying to parameterize the  registration page. The script for entering  single and multiple data into registration form is explained below.

Script using Single data

clickAndWait link=logout 

Script using Multiple data


4)How it works
‘forXml’ command in the script is used to set the target of the XML file’s path. End the test script by adding ‘endForXml’ , both these commands are provided from the SelBlock Add-on. Replace the  keyword with variable in test data file  by using ‘${VARIABLE}’ syntax.

When this test is executed, Sel Blocks loads the content of XML file in memory and executes the script for number of times <vars> element present in the XML file. In this example it will execute the test for five times. For all the attributes mentioned in <vars> element, Sel Blocks create internal variables that we can substitute as Selenium command parameters. You can analyse the Selenium IDE Log tab for  results. If the expected data and actual data do not match, an error is reported in the Selenium IDE Log tab.

Know More About This Topic from our Techies

Check out how complex technology stack deployed to deliver amazing IoT solutions

Table of Contents

    Contact Us


    What's on your mind? Tell us what you're looking for and we'll connect you to the right people.

    Let's discuss your project.