But after digging through our own numbers we were surprised to find that, despite the dramatic shift of comsumers viewing the world wide web through the supercomputers in their pockets, our customers are still testing the desktop-based experience on their websites and applications over mobile by a vast majority.
Out of the 45 million tests we've run this year, less than 5% are being run with mobile in mind. Now, granted, not all of our customers will be offering a mobile/responsive version of their web application or site, but still, the "mobile test runs" numbers are a lot lower than we expected.
Here's a breakdown of test runs so far this year by desktop vs. mobile:
Here's the same data broken out month over month:
While there is the slightest uptick in the mobile test runs, it's pretty clear that our users are taking a very "desktop-centric" approach to web site and application testing.
This part is actually quite simple: Ghost Inspector provides a very tidy solution to this problem called "viewports", an option that is available at both the Suite and Test level. But we'll come back to that in a second, first...
Let's get started by recording our first responsive test. Since you're already using our test recorder in Chrome (you are, aren't you?) we will use another feature in Google Chrome called Device Toolbar.
To activate the Device Toolbar we first need to open Developer Tools (Hamburger > More tools > Developer tools) and toggle the Device toolbar icon.
Now Chrome has modified our browser viewport to mimic mobile resolution, and we should see our responsive design in the window! From here we can also select a device preset within the Device Toolbar or enter custom dimensions. I've selected iPhone 6 375x667. You've probably noticed that the mouse cursor has turned into a semi-transparent grey circle which represents where you will touch (click) the interface.
Next we can fire up our test recorder extension as usual and start making some assertions!
As you navigate your site or application our test recorder will capture your events just as it would when you navigate the desktop version. When you've finished recording your steps and assertions, let's give the test a name and select the Suite we want to save it to, uncheck Execute initial test run and then click Save this test.
Let's see all of that in action:
Once we view our test Ghost Inspector app we can set the screen size for our test in the Test Settings (Settings > Display Options > Screen Size. I've selected 375 x 667 - Apple iPhone 6 (Portrait) which is the same resolution I used to record the test. Now click Save Changes and run the test! When your test is executed in our cloud infrastructure, the viewport of our test runner's browser will be set to the dimensions you've selected.
Now our test should run and when it's finished we can inspect the steps, video, and screenshot, and console output just like any other test.
You also have the option to set the screen size defaults at the Suite level (Settings > Test Defaults > Display > Screen Size). Setting this value will provide a default viewport size for all subsequent tests within the suite, unless you override at the test level.
We've provided a number of presets that you can select to mimic a visitor viewing your site on a number of devices:
* available under paid subscription
And if that wasn't good enough, you also have the ability to modify the viewport of a test at will through our API as well. Here's an example using
$ curl -s https://api.ghostinspector.com/v1/tests/<testId>/duplicate/?apiKey=<apiKey>&viewport=375x667
This API call will request that the test be executed with a
375x667, simulating our iPhone 6. Head over to our our API for more details.
And that's it! We hope that this post has given you some ideas about how to approach testing your mobile or responsive website design and that these options will give you greater flexibility when it comes to your mobile-first strategy. Here are a few tips to keep in mind while testing:
As always, if you get stuck or have any questions, drop us a line on the support channel and we'll be happy to help!
Aaron has been breaking computers since the time of the TRS-80 and has loved programming ever since. He has a passion for software testing and enjoys playing bluegrass music, as well as gorging on Netflix with his wife on those long, cold Canadian winter nights...Web Twitter Google+