Introduction
Mobile testing in ATS is an experimental feature and only available to closed beta testers.
Compatibility
Aspect | Supported |
---|---|
Mobile Operating System | Android 6.0 "Mashmallow" |
Selenium Provider | Sauce Labs (via TestObjects) |
Test Browser | Chrome |
Recorder | Chrome (via a custom mobile device profile) |
ATS Helper | Chrome (via a custom mobile device profile) |
Application type | Web applications with mobile view |
Preparations
Some preparations are required before you can start to test on mobile devices.
Creating a Mobile Device Profile
In order to enable a proper working of the recorder and ATS Helper we need to create a custom mobile device profile in Chrome.
Follow stese steps:
- Open Chrome
- Press F12 to open the DevTools
- Press F1 to open the settings dialog
Select the Devices tab
- Select Add custom device
- Set the following properties
- Device name to ATS mobile
- Width to 540
- Height to 960
- Device type to Mobile (no touch)
Select Add
- Close the settings and the DevTools by clicking the x button in the top right corner twice
Creating a TestObjects Account
Running a test on a mobile device requires an account with TestObjects (part of Sauce Labs). They offer a free account for 1 concurrent test. Follow these steps:
- Go to TestObjects website
- Sign up and confirm via the email you receive from TestObjects
- Go to TestObjects and login with your new account
- Click New App
- Click Mobile Website
- Set random values for Website URL, Website name and Version and save
- Save the device settings by clicking Save
- Hover the button AUTOMATED TESTING and select APPIUM
- Click on Get Started
- Write down the API Key, you'll need it later
Configuring TestObjects in ATS
You'll need to configure your TestObjects as a Selenium endpoint in ATS. To do so, follow these steps:
- Open ATS and switch to one of your apps
- Navigate to the Settings by selecting Show Test Settings in the profile menu
- In the section Selenium hubs click New
- Set Name to TestObjects and URL to https://eu1.appium.testobject.com/wd/hub
- Under Custom Capabilities click New
- Set Key to testobject_api_key, Type to String and Value to the API key that you've written down
- Save the capability
- Save the Selenium hub
Creating Mobile Test Cases
After preparations are finished we can start to create our mobile tests. Creating a mobile test is very straightforward. There are only a few differences that you should understand. They are described in the next sections.
Activating the Mobile Device View
In order to see the mobile screens of your app in Chrome, you need to enable the mobile device view. In this mode you'll also be able to use the ATS Helper and Recorder.
Follow these steps:
- Open Chrome
- Press F12 to open the DevTools
- The the DevTools switch to the tab Sources
- Press CTRL+F8 to deactivate breakpoints (breakpoints would prevent proper use of the Recorder and ATS Helper)
- Press CTRL+SHIFT+M to enable the mobile device toolbar
In the mobile device toolbar select the new device profile ATS Mobile
Using the ATS Helper and Recorder
Enable and use the ATS Helper and Recorder as usual as long as the mobile device profile is enabled.
Native Dialogs
Usually a web application is used on a mobile device, the devices adds native dialogs in some places to improve usability. These places are:
- In dropdowns
- In date fields
- In time fields
- In date time fields
All standard actions should also work on a mobile device. Also in places where native dialogs are used. The actions simply work around these dialogs and set the values directly. In order to make the testing more realistic you can even automate the native dialogs. In order to do this, make use of the following mobile specific actions:
Scenario | Standard Action | Mobile Action |
---|---|---|
Setting a time field | Set Value | Set TimePicker |
Setting a date field | Set Value | Set DatePicker |
Setting a date time field | Set Value | Set DateTime Picker |
Setting a drop-down field | Set Value | Set DropDown Value |
Recording
The recorder does not know the new mobile actions. It will always return a mapping to the non-mobile actions. You can later exchange recorded steps and use a new mobile action.
Running a Test Case on a Mobile Device
Once you've created a test case for mobile you'll want to run it. This is what you have to do:
- Open your test case
- Click Run and then Edit Run Configuration.
- Select TestObjects as Selenium hub
- Enable the new checkbox Mobile testing
- Click Run
Known Limitations
- Using touch ations in the mobile device profile is not possible. The ATS Helper and Recorder are not compatible with touch actions.
- Only devices with english language setting are supported
- It's not possible for the user to select the mobile device type. It defaults to Motorola Moto E (2nd gen).
Type | Description |
---|---|
Device | Motorola Moto E (2nd gen) |
Platform | Android |
Version | 6.0 |
API level | 23 |
Resolution | 540x960 px / 4.5" |
CPU | ARM quad-core 1200 MHz |
RAM | 1024 MB |
Browser | Google Chrome |