Have I mistakenly assumed that my routines are loosely coupled?
- by Tarun
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.