Best Practice: Use Page Objects to Model Repeated Interactions and Elements

  • 18 May 2021
  • 0 replies
  • 28 views

Userlevel 1
Badge +1

Within your applications and sites there are elements that your tests interact with, sometimes on a repeating basis. Rather than having to repeatedly code these interactions into your test, you can use page objects to abstract these interactions into a single functional unit. For example, your tests may require logging into a a site or application. Rather than coding all these interactions into your test, you can create a LoginPage object that contains these interactions, which you then refer to in your test. This means taking a sort of object-oriented approach to test construction that  enables you to simplify your test code and reduce duplication of effort. For more information, check out these references.


0 replies

Be the first to reply!

Reply