Device Simulation

From bemoko developer wiki

Jump to: navigation, search

Introduction

Device simulation is the act of sending the appropriate HTTP header such that system responds as if the real device had connected. The various forms of device simulation are discussed below.

PC Browser with Header Switchers

PC Browsers are much more mature than the typical mobile browser and provide functionality that make life easy for a web development cycle - for example easier to go to URLs, easier to manage bookmarks, view source and view headers. With the appropriate level of understanding, they can provide an invaluable tool to give a reasonable idea of what a web site will look like on a mobile device.

Firefox provides a rich extension capability which has led to the development of many third-party tools for a web developer. Some of particular note are Modify Headers and User Agent Switcher which can be used to get control of the HTTP headers sent to the web site and hence allow you to simulate a device request. You will possibly find the XHTML Mobile Profile Firefox Add-on useful as well if the mobile site is returning a XHTML Mobile Profile mime-type. wmlbrowser might also come in handy if your site needs to support WML.

And finally, as with any kind of web, Firebug is very useful to help you debug the markup being delivered including support for tweaking styling on the fly.

Command Line Requests

Command line tools such as wget and curl can be used to script up requests to web sites and allow full transparency on the HTTP flow. In times of deep troubleshooting it is useful to create a controlled and repeatable test that can be shared with members of the team to help with the fix and verification cycle.

For example the following command will make a request to the bemoko web site as a Nokia N95 would:

wget -U "Mozilla/5.0 (SymbianOS/9.2 U; Series60/3.1 NokiaN95_8GB/10.0.007; Profile/MIDP-2.0 Configuration/CLDC-1.1 ) AppleWebKit/413 (KHTML, like Gecko) Safari/413" http://bemoko.com

Test Frameworks

See Automated Testing.