Testing of Mobile Devices
Often the biggest consideration when testing mobile applications is the ability to test across different devices, and also different OS platforms.
The ideal goal is to achieve such coverage with minimal effort expended on script rework, and indeed duplication of your test scripts. T-Plan Robot allows you to reach this goal simply and efficiently through a single test script, and the use of "image collections".
As T-Plan Robot automates at the screen level it drives your application through the displayed components. Assuming your application follows the same flow rules for navigation etc then your action list need not change, however the images used to find these components may. So what does this mean in terms of your automation script...
Taking a blind example for the moment, the application flow may be as follows:
Actions:
- Launch app
- Tap Username field
- Type username
- Tap Password field
- Type password
- Tap Login
- From application Home screen, tap Portfolio
- Tap View Account
- Tap Generate Report
... etc
As you can see the flow within the application should be the same regardless of the target environment. As a result your test script can also contain these same actions which can be performed during each execution regardless of target environments. However, identification of where each action should be performed, in terms of the visual screen, may differ. To allow for this within Robot you simply allow your script to reference a collection of images as opposed to a single image. This is an extremely efficient way of scripting which promotes a number of benefits:
- Quickly and easily expand test environment coverage by adding to your existing image collections
- Test new devices without any script rework
- Test new mobile platforms without any script rework
- Consistent reporting across test environments
So how would such a script look within T-Plan Robot... well, funnily enough almost identical to the action list above.
In the following example code we first create a 'procedure' which becomes a reusable piece of code allowing the subsequent code to be very simple and minimal. Naturally any of this code can be changed as desired.
# First create the reusable 'tap' procedure:
Procedure Tap { Waitfor "match" method="search2" template="{1}" if ({_EXIT_CODE} == 0) { Step "Click {1}" result=fail Exit 1 } else { Step "Click {1}" Mouse click to=x:{_COMPARETO_CLICK_X},y:{_COMPARETO_CLICK_Y} } } // Script Body // Tap MainApp Tap Username Type username Tap Password Type password Tap Login Tap Portfolio Tap ViewAccount Tap GenerateReport Tap Logout
Given that the above code utilises 'image collections' it can easily be executed against many different target environments and operating systems with zero impact on the code.
Video showing multiple GUI Test Executions
Essentially, the testing of any platform is achieved the same way when using T-Plan Robot. The tests for mobile applications are designed, executed and debugged in exactly the same way as a desktop application or a web application or any other type of application - using visual references and real end user actions.