Skip to main content

Posts

Showing posts from December, 2011

How to Achieve More Stable End to End Tests

Recently myself and another colleague wrote an acceptance test for a feature that had yet to be implemented. For this end to end test we used Selenium, after all we wanted to test the whole feature so this made sense. Our test performed some simple user input, performed a calculation and checked the response. The problem with the test was it was very brittle. If the application had not recently been used, the massive data set the application relied on would not be cached.To get around this we added a few Thread.Sleep() statements into the test. This worked rather well for the majority of test runs, but sometimes these pauses were not long enough. On the other hand sometimes the data was cached, meaning these sleeps would be unnecessary. One resource which has recently done the rounds was regarding useful advice about using WaitForPageLoad() and WaitForCondition(). WaitForCondition will only execute once a condition has been m…

6 Ways to Speed Up Selenium Tests

Having finally achieved more stable end to end tests via Selenium, we figured it would be worth while sharing how we achieved this. The following are six steps we've found that you can do to make Selenium tests more stable.Turn off automatic updates for your browser/pluginsSet your IIS (or equivalent) app timeouts to zeroCreate a base Selenium Fixture for use in your testsUpdate to the latest version of SeleniumWarm up your apps prior to testingDitch Selenium - test at the API levelTurning off automatic updates seems like a no brainer, but after a fresh install we forgot to do this once and spent some time figuring out why Firefox would not load on the CI server. It turns out that the "You've just updated" window was blocking the test from continuing as it had stole focus.The second point is with regards caching and the general responsiveness of your application. We have a few applications that take about thirty seconds to fully warm up due t…