Data Driven testing using selenium !
This post will also be in the new blog dedicated to Selenium <- coming soon
You will have to record your script using Selenium IDE in firefox browser
Then export the script in any of the programming languages in which you are comfortable….(Hope you know how to export since you are using that tool now, that’s why you are reading this post
)
Lets use Java as an example here.
Now you have to connect to the Selenium RC by using the jar’s which are getting with the Selenium RC (which is used to test the application in any of the browsers where as using Selenium IDE you can only run the scripts in firefox)
now just open the script in eclipse or netbeans
then you can define a class and constructors to initiate the variables and you can run the script then the selenium will chck for the multiple values for a field.
first you have to give the invalid values then the valid values
An example is attached for date validation (format dd/mm/yyyy), string validation and number validation
public class fieldValidations { public String[] dayValidation() { String day[] = { "45", "00", "1", " 1", "1 ", "a2", "2a", "1#", "#1", "#1" }; return day; } public String[] monthValidation() { String month[] = { "13", "00", "1", " 1", "1 ", "a2", "2a", "1#" }; return month; } public String[] yearValidation() { String year[] = { "0000", "asdf", "as12", "122#","#232", "12as", "12 ", " 09", "09", "009" }; return year; } public String[] numberValidation() { String[] number = { "as", "2a", "a2", "2@", "@2", " ", "@#", "-23" }; return number; } public String[] stringValidation(){ String[] string = {"asdf","1234","!@#$"}; return string; } }


