I just want to ask ideas from you on which is more appropriate to use. I'm currently automating a project using Selenium Webdriver adapting the Page Object Model approach. In the midst of my testing, I realize if it's a good way to separate every steps, or put it in one single workflow? Is it OPTION A or B ?. I provided my pseudo-code below.
Example:
=== OPTION A (3 steps, each step has a method) ===
class TestCase{ // the controller
method login{
enterUsername();
enterPassword();
clickLoginButton();
}
}
class LoginPage{ // the view
method enterUsername(){
sendKeys("user101")
}
method enterPassword(){
sendKeys("password1234")
}
method enterPassword(){
loginButton.click();
}
}
=== OPTION B (3 steps are in one method)===
class TestCase{ // the controller
method login{
userLogin();
}
}
class LoginPage{ // the view
method userLogin(){
sendKeys("user101")
sendKeys("password1234")
loginButton.click();
}
}