Skip to content

Instantly share code, notes, and snippets.

@stirno
Created August 28, 2011 03:05
Show Gist options
  • Save stirno/1176188 to your computer and use it in GitHub Desktop.
Save stirno/1176188 to your computer and use it in GitHub Desktop.
Example automation test API
[TestClass]
public class LoginTests : StirnoTestDriver
{
[TestMethod]
public void Login_HappyPath()
{
I.Use(BrowserType.InternetExplorer);
I.Open("http://idev05/Login");
// Validate expected strings on page
I.Expect.This("Username").In("label.username-field");
I.Expect.This("Password").In("label.password-field");
// Perform login
I.Enter("username").In("input.username-field");
I.Enter("password").In("input.password-field");
I.Click("input[type='button'].login");
// Validate login successful
// No errors
I.Expect.Null.In(".error + input.username-field");
I.Expect.Null.In(".error + input.password-field");
I.Wait(TimeSpan.FromSeconds(2));
// Forwarded correctly
I.Expect.Url("http://idev05");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment