0

I am working in python Page Object for automation. I have a basePageObject(ChangePasswordPage) and it has 4 other child pages which differs by the by the fields on the page. All these change password page runs on the same URL but they differs with the fields and that depends with the use cases. For instance one has , old password field ,other has not , again one comes with security question and answers and like that. That's why I created the different child classes for all these variations.

Now my problem is , I have to write an operation that recursively tries to change the password with the sets of passwords given. I can't write that operation within the child change password page because that recursive operation requires the "changePassword" operation of the child classes. Furthermore , this recursive operation for each child classes is different. Its not the same for all the child classes. So which pattern suits best with this case. Where do I write this new recursive operation , how do I create new class and how can I apply OOP principles.

prabeen giri
  • 803
  • 7
  • 18
  • 6
    Please provide some code. There are hints here that you may have more fundamental design issues going on, but without code, it's hard to tell anything. – Silas Ray Nov 16 '12 at 17:21

1 Answers1

1

It's a general question, but I think you can try the Strategy Pattern. You write the methods needed for the "change password" use cases and keep them abstract in the basePageObject. In all the ChangePasswordPageObject you implement a concrete password-changing method.
So you have basically the same method call in all cases but it performs different actions depending on the use case/password page.

Alessandro Da Rugna
  • 4,571
  • 20
  • 40
  • 64