Hello,
For example, my app has 3 pages and i wanted to test all three pages.
My question is, it a good practice to write separate @Test for each page or is it more efficient to test all the pages in single test method?
Thank You.
Hello,
For example, my app has 3 pages and i wanted to test all three pages.
My question is, it a good practice to write separate @Test for each page or is it more efficient to test all the pages in single test method?
Thank You.
I personally split the tests based on scenarios. So i have 2-3 tests only in one page. It’s more reliable, because if your test will fail in the 1st page then you cannot validate the other 2.
For me, i create for each page an Object class which contains all the actions possible in this page. Then i create Test Class based on Test cases Login.java, SignUp.java.
This way in the Test Class you can call an action class from all the Object classes.
for example given a test class named Login.java, we will use 2 action from 2 different object class
action 1: redirectionToLoginPage(); from object class HomeView.java
action 2: SignIn(login,password); from object class LoginView.java
we will have something like this:
public class Login {
private static HomeView homeView=new HomeView;
private static LoginView loginView=new LoginView;
@Test
public void RedirectingToSignInView(){
homeView.redirectToLogin();
}
@Test
public void SignIn(){
signInView.SigningIn("login","password");
}
}