Thursday, December 17, 2009

Data Driven Testing is possible in Selenium RC

Data driven testing is possible in selenium RC by having a separate class, that have methods to provide the data needed to do the field validation. call the methods in that class for doing the field validation for the required fields in your test. Here is a example for number validation.

public class fieldValidations {
public String[] getNumberValidation() {
String[] number =
{ "as", "2a", "a2", "2@", "@2", " ", "@#", "-23"};
return number;
}
}


provide your field with the values in the method getNumberValidation (For example)

fieldValidations object=new fieldValidations();
String value = object.getNumberValidation();
for (int i = 0; i < value.length; i++) {
selenium.type("Field Name", value[i]);
}

No comments:

Post a Comment