Skip to content

Instantly share code, notes, and snippets.

@jmarnold
Created June 13, 2012 14:35
Show Gist options
  • Save jmarnold/2924443 to your computer and use it in GitHub Desktop.
Save jmarnold/2924443 to your computer and use it in GitHub Desktop.
Lessons learned

Lessons Learned from Testing Firefly

  • Use the fastest feedback cycle that gives you meaningful feedback!
  • Test input lives with the test expression
  • Make test input setup declarative and only need to specify what's germaine to the test
  • Make test input as easy to setup as possible. Default values, etc. The ObjectConverter, interpret string as data structure is good
  • Standardize your UI mechanics
  • Use conventions driven off Strong typed names to tie the screen drivers to the UI!
  • Separate expression of a test from the actual screen driving -- Use StoryTeller/Cucumber as a DSL layer over WatiR/WebDriver
  • The pre-login type stuff. Don't make the tester specify every time
  • Smaller, focused tests
  • Provide contextual information about failures. Use the dropdown box "Hey, this option isn't available!" example
  • Standardize screen manipulation -- our auto complete business, the ElementHandler stuff
  • FubuMVC centric, but the EndpointDriver/NavigationDriver is killer. The way we can easily call backend Ajax services
  • The standardized "wait for all Ajax requests to be done" is very, very nice
  • WebSocket watcher
  • Utilize White box testing for cheaper tests -- the way that we override the clock during tests, call alarms directly, wait for polling jobs, whatnot
  • Awesome if you can collapse the app to a single AppDomain for purely functional testing
  • The "I can drop and recreate the state of the system in a drop of a hat" thing
public static class Wait
{
public static void Until(Func<bool> condition, int millisecondPolling = 500, int timeoutInMilliseconds = 5000)
{
if (condition()) return;
var clock = new Stopwatch();
clock.Start();
var reset = new ManualResetEvent(false);
ThreadPool.QueueUserWorkItem(o =>
{
while (true)
{
try
{
if (condition()) break;
}
catch (Exception)
{
// Yeah, that's right. I wanna swallow these exceptions
}
Thread.Sleep(100);
}
reset.Set();
});
reset.WaitOne(timeoutInMilliseconds);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment