samedi 4 février 2017

storing test data for a test framework using the page object model

What are some recommended ways to store data for a java test framework using the page object model? For example, I have a login test scenario with a LoginPage page object and a LoginTest which uses the LoginPage to run tests. I say something like

public class LoginTest {
   public void testLoginScenario() {
       LoginPage page = new LoginPage(getDriver());
       page.enterLoginInfo("username", "password");
   }
}

I want to store the "username" and "password" constants somewhere, but I don't know what the best way to do this is. Should I create a data.properties file and read from that? Should I keep these stored as final static constants in some TestData java class? This is a very small amount of test data so I don't think I would go the route of storing in a database or CSV.

Aucun commentaire:

Enregistrer un commentaire