Read Part 1 for the introduction to the mobile web application test automation.
Mobile browsers have come a long way from being very basic browsers that displayed only static browsers to the present day advanced browsers that are virtually as equipped as the regular browsers. Mobile Websites rendering full blown content came hand in hand with the advancement in Mobile Browser Technology and the same brought in demand for high end mobile browser testing. But it was very impractical to test such stuff on hundred of handheld devices. It was the need of the hour for tools that would simulate a mobile browser type environment on the regular browser. Of course there were simulator tools, but each OEM had their own tool with limited functionalities.
There are multiple approaches to test web application
1. Actual Device
– Testing on it could be more perfect and effective, but on the other side, you must need to have large number of device lab or need subscription for this lab.
– It is also time consuming to check your test on each and every device manually.
One can perform automation for all those device and run script but you need subscription for those device lab for that.
– In this case, you treat your browser as device and apply simulation for different phone
– This become cost-effective approach
Let’s look at simulation approach.The question is how would simulation work. How would a web browser camouflage itself to appear as a mobile browser. The answer to that is user-agent headers/profile.
Each mobile device contains certain information which identify one phone behavior from other. That unique information is mentioned and explained below.
1. Accept : Contains list of MIME types accepted by user agent
2. User-Agent: Contains information used to identify device and detailed information for that device. Below is example of user-agent string and each of its artifacts.
A sample iPhone User Agent String and its understanding is mentioned below.
Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3
Mozilla : It’s a Mozilla based browser
5.0 : The version of the browser
iPhone : Apple iPhone
U : Security Value. U denotes Strong Security
CPU like Mac OSX : Operation System iPhone OS based on Mac OS X
en : Localized language for the Browser English
Apple Webkit : A set of core classes to display web content
420 : Version of the Webkit build
KHTML : KHTML Engine like Gecko
Version : Safari Version 3.0
Mobile : Mobile Device
1A543 : a iPhone Firmware Version
Safari : Name of the browser
419.3 : Browser Build
3. User-Agent Profile: User-Agent Profile is an xml document which describe device capabilities e.g screensize
All above user-agent headers and user-agent profile will change the browser behavior to mobile behavior.
Certain tools are available which changes user-agent header/Profile and simulate a similar environment on a different browser. Such tools help a lot in multiple environment mobile testing. Bayden UA Pick, Fiddler, etc are examples of such tools.
In next part of our article, you can find, detailed information about some simulation tools for IE and Firefox.