Have I mistakenly assumed that my routines are loosely coupled?
Posted
by
Tarun
on Programmers
See other posts from Programmers
or by Tarun
Published on 2012-09-11T07:15:35Z
Indexed on
2012/09/11
9:50 UTC
Read the original article
Hit count: 196
My Selenium test structures goes as -
Data Object class -
public class RegistrationData {
String firstName = "test first name";
String lastName = "test last name";
// Getter Setter Here
}
Page Object class which carries out operations on a Web Page -
public class RegistrationPage {
private RegistrationData regData;
public void setRegistrationData(RegistrationData regData) {
this.regData = regData();
public NewAccountPage fillRegForm() {
enterFirstName("FirstNameTextBoxLocator", regData.getFirstName);
enterLastName("LastNameTextBoxLocator", regData.getLastName);
// Some more fields are filled here
return NewAccountPage();
}
}
And test class uses them as -
public class TestRegistration extends SelTestCase {
@Test
public void testRegNewUser() {
RegistrationData regData = new RegistrationData();
RegistrationPage regPage = New RegistrationPage();
regPage.setRegistrationData(regData)
regPage.fillRegForm();
// Some assertion here
}
}
Now since fillRegForm method does not take any argument, Can I assume that it is an example of loose coupling despite I need to set RegistrationData in RegistrationPage before being able to use fillRegForm method.
© Programmers or respective owner