Web designFeature

Top tools for testing your responsive site

Technical leads John Cleveley and Tom Maslen reveal the tools they use to ensure the BBC News site behaves itself.

RWD has far more visual variations than traditional approaches. This can lead to frontend code becoming increasingly fragile.

CSS preprocessors, such as Sass, can help in keeping code DRY and modular. For JavaScript, RequireJS promotes great, decoupled code if used correctly. But even with the best code in the world, testing all the responsive variations is the only way to be confident the site works.

Real devices

You can't get better than having real devices to test on: feeling the tactile response and quirks can make the difference between a good site and a great site. This is tough for small teams who can't afford a cupboard full of devices, but even investing in a few of the most popular ones will be money well spent.

Simultaneous device browsing

Once you start to build up your collection, a tool like Remote Preview saves a lot of time. It lets you preview your site on a large number of mobile devices at the same time, so you can quickly scan through your pages across devices and pick up layout and behaviour issues.

Automated behaviour tests

If manual testing sounds too much like hard work, adding a suite of automated tests is well worth the initial upfront cost. We use a combination of:

For responsive sites, you can easily resize the PhantomJS window to check behaviour at your breakpoints. For example, we can test if HTTP requests for 'Tablet' components aren’t requested by smaller devices.

Visual regression tests

PhantomJS has another killer feature. You can take fully rendered screen shots of your site. We use this to crawl the site, taking shots of pages on our live site and re-running on our test server. You can process the images with ImageMagick to compare each page at each resolution. Picking out visual regressions becomes a piece of cake.

Performance testing

Performance is probably the easiest area to neglect. But ignoring it can slowly ruin your site. Again, PhantomJS to the rescue! The browser has an API to save an HTTP ARchive (HAR) file, which records all the requests made by the browser.

Uploading HAR data to a tool such as HAR Storage or HTTP Archive helps to visualise HTTP metrics over time and highlights areas to optimise.

Words: John Cleveley and Tom Maslen

Tom Maslen is technical lead at BBC News. He likes current affairs, HTMl5, biscuits and spicy Monster Munch. John Cleveley is also technical lead at BBC News, currently migrating the news site to a dynamic platform.

This article originally appeared in .net magazine issue 243.

Liked this? Read these!

Seen a great responsive site? Tell us in the comments!

Subscription offer

Log in with your Creative Bloq account

site stat collection