Automated Testing for Mobile App Development
Robust and repeatable testing improves any software development project. If you’re creating a mobile app, testing is especially critical given the unpredictable range of end user devices and location variables. Altova MobileTogether includes sophisticated Automated Testing features that let developers:
- Record a series of user actions as a test case
- Replay the test case in the MobileTogether Designer Simulator environment
- Deploy test cases to the MobileTogether Server for replay on a variety of client devices
- Retrieve Test Run results from the server and compare differences
You can even modify the app to fix a bug and run the test case again to validate the results of changes, which makes this an indispensable QA tool for your mobile app development process.
Let’s look at an app that uses GPS, where running a test case can influence a design decision.
The Start Geolocation Tracking action in the MobileTogether Designer allows the developer to choose GPS + Network tracking or GPS only tracking. We can test the app using both variations and compare results.
Here are screenshots of the GPS app running on an Android phone and iPhone:
The app workflow waits for the user to turn on GPS tracking, then captures a single location via the Update Location button. The app records the location and turns off GPS tracking again to save battery power and data transfer until the user wants to record another set of coordinates.
Test cases are recorded, played back, and managed via MobileTogether Designer menu options or toolbar buttons located directly above the Design window.
We set the action of the Turn On GPS radio button for GPS only tracking, then recorded a test case in the Simulator that captures two data points. Since the Designer workstation is not likely to have geolocation hardware, the first test run used a datafile of coordinates to simulate GPS data.
Next, we deployed the app and the Test Case to our MobileTogether Server:
Then we activated the test case on the MobileTogether Server via the Server Web interface and selected playback and data recording options:
Activation on the Server allows the automated test case to run on any connected client device. We ran once on an Android and once on an iOS device.
Automated Testing of App Revisions
All defined test cases remain linked to the app even as the developer makes revisions. We went back into the app and changed to functionality of the GPS radio button to activate GPS+Network location tracking.
We replayed the test once more in the Simulator, deployed the new version of the app to the MobileTogether Server, and ran the test again on both client devices. Now we have six test runs available to examine in the Manage Test Cases dialog:
Red tiles in the image above denote variations in test run results.
Comparing results of the two Android phone test runs showed only a very small difference in coordinates captured with both GPS settings, as seen in each comparison window:
The iOS phone also captured different coordinates on its test runs:
Execution of saved test scripts allows app developers to:
- Validate app behavior if underlying data changes, such as the result of database queries or REST web service requests
- Verify bug fixes by replaying the set of actions that caused the error in a new version of the app that incorporates the fix
- Ensure no unexpected behaviors are accidentally introduced in new versions of the app
- Preview how the same sets of user actions look on different mobile client devices
Get started with automated testing for your own cross-platform mobile apps. The MobileTogether Designer is free to download and use!