Method code too large

This is turning into a mantra it seems…

Take your common test code, turn it into Classes/Methods and store them under Keywords (they don’t need to actually BE keywords, but there’s nowhere else I’ve found that works easily). For example, if you have a page called “my Fabulous page”, make a class called MyFabulousePage and add methods that “wrap” logical parts of the page’s functionality.

Then you can write code like…

MyFabulousPage.navigateTo()

MyFabulousPage.addNewUser("Russ", "!my@secret#pass$word%", "!my@secret#pass$word%")

Login.loginUser("Russ", "!my@secret#pass$word%")

Logout.logout()

All the “test” steps are inside the methods. Plus, this way, you’ll end up with core methods that you’ll reuse on many pages making your tests more robust and reusable.

5 Likes