While writing a page object method which of the following "method signature" you think is/are correct & Why?
public String getScreenDataAndGoToNextScreen()
public boolean login(String username, String password)
public void clickOnTheCheckinButton()
public List<String> tableDataAtDataScreen()
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.
Comments