Skip to content

Robot Pattern

Devrath edited this page Jun 29, 2021 · 5 revisions

What is the use case to use a robot pattern

  • Consider a scenario where there is a check-box and we have a logic that sets it checked/not-checked based on logic.
  • Now if we change the check-box to a image-view then a lot of things need to be modified.

Solution - Separate what from how

  • By separating what and the how our tests are more maintainable.
  • In above example,
    • What -> whether the checkbox needs to be checked.
    • How -> whether the widget is checked.

Robot Pattern

  • This pattern exposes an API that separates what and the how.

Advantages of Robot Pattern

  • Test cases are more readable.
  • The entire logic is encapsulated in a separate place, so if the UI changes then we just need to modify the test case in one place.
Clone this wiki locally