top of page

POM Concept

While writing a page object method which of the following "method signature" you think is/are correct & Why?


  1. public String getScreenDataAndGoToNextScreen()

  2. public boolean login(String username, String password)

  3. public void clickOnTheCheckinButton()

  4. public List<String> tableDataAtDataScreen()

  5. public FooClass clickFooButton()



Reason 1:


1 - Violates SRP, consider breaking into two functions. 2 - It's a good practice to validate positive and negative scenarios through return type as boolean.

Eg. With valid username and password script should return true; and with invalid one it should return false. 3 - I would replace that with a generic button.click(), otherwise there would be many such click functions. The function should be part of a bigger workflow. 4 - Should return a double dimensional data structure since it is table data. So probably List<List<String>> or List<String[]> seem better choices for a return type. 5 - Looks fine except the same comment as #3. The "correctness" is contextual as in #3.

22 views0 comments

Recent Posts

See All

Comments


bottom of page