I am evaluating a couple of different frameworks for test automation. One of the things I really like about WatiN is the page model for abstracting page code from your tests.
Watin Example for a login Page:
public class AVLoginPage : Page
{
public TextField Email
{
get { return Document.TextField(Find.ById("UserLogin_UserName")); }
}
public TextField Password
{
get { return Document.TextField(Find.ById("UserLogin_Password")); }
}
public Button LoginBtn
{
get { return Document.Button(Find.ById("UserLogin_LoginButton")); }
}
/// <summary>
/// Enters the email and loging in to the corresponding boxes and clicks the login button.
/// </summary>
/// <param name="email"></param>
/// <param name="password"></param>
public void Login(string email, string password)
{
Email.TypeText(email);
Password.TypeText(password);
LoginBtn.Click();
}
}
Can I do something like this with WebAii?
So here is the approach I have started to take using the WebAii libraries:
My test code looks like:
I then have a library:
This allows me to abstract the actions on the page from the test code itself.