How to optimize your tests using the Page Object Model.
Page Object Model is an object design pattern, in which for every web page in the application, there should be a relevant page class, various elements on the page are defined as variables on the class. To interact with different elements of web page methods are implemented in the class.
public class HomePage {
//Variables
@FindBy(xpath = "xpath")
private WebElement signInButton; @FindBy(xpath = "xpath")
private WebElement userAvatar; //Methods
public void clickSignInButton() {
signInButton.click();
}
Why should we use the Page Object Model?
So now with every change on a webpage…
Hi, there!
First of all, JUnit is an automated test framework that is built in Java, whereas AssertJ is an opensource library used for writing fluent and rich assertions in Java tests.
It’s true that you can write assertions just using JUnit, but if you ever have an extra half an hour for studying AssertJ, be sure to go for it. It will make your working process more effective and your code more readable.
Took me less than half an hour to get AssertJ.
QA and free artist