AWS Device Farm integration
The AWS Device Farm (ADF) integration is ideal for unattended testing, where you are unsure of which devices will be available at the time of the test. This topic describes how to set up your environment to work with the Amazon Device Farm.
To set up your Amazon environment:
- Make sure you have an active Amazon Web Services (AWS) account. If you do not have one, create a new account. AWS Device Farm should be set up for this account. For details, see Setting up AWS Device Farm.
Open the Amazon EC2 console. In the navigation bar, select the Oregon region, and search for the UFTM_ADF_Server_3.40 Amazon Machine Image (AMI).
- Launch an EC2 instance. A t2.medium instance type is recommended.
- Configure the instance details if required. Usually there is no need to change the default configuration.
- In the Configure Security Group, add a security group to allow secure connections. In the Inbound tab, create an HTTPS rule for port 443 from the source address 0.0.0.0/0.
- Launch the instance.
In the list of instances, select the instance to view its properties.
- The connection to the ADF server is a secure SSL connection. If you intend using the ADF server's self-signed certificate, copy the IPv4 Public IP from the Description tab of the instance to your clipboard. When using a Certificate Authority (CA) certificate, use the DNS address used to create the CA certifiate.
Tip: By associating a fixed IP address with an EC2 machine, you can avoid having to change the IP details after reboot. A reboot is only necessary after assigning a fixed AWS Elastic IP to an ADF Server. The reboot is required to regenerate the self-signed certificate on the ADF server installer due the change in the IP address. For details, see the AWS documentation.
Configure UFT Mobile
To configure UFT Mobile to work with the Amazon Device Farm, you need to specifiy the required settings in Administration Settings.
- In UFT Mobile, select the Administration menu and click the Settings tab. In the left panel, select Amazon Device Farm integration.
- Enable the ADF connector.
- Provide your Amazon secret key.
- Provide the name of the connector that will be used to access the AWS Device Farm or keep the default UFT Mobile Server if connecting via the connector embedded in the UFT Mobile server. The Connector machine's clock must be synchronized with the Internet.
When using a proxy server to access Amazon web services, enter the proxy machine details. Note, that proxy server must be accessible to the ADF connector machine defined above.
- In the AWS Device Farm Server Address field, paste the address that you copied to your clipboard when setting up the ADF server.
- The connection to the AWS server is a secure SSL connection. When using a self-signed certificate, turn off the ADF server verfication setting. When using a certificate from a Certificate Authority (CA), enable the setting and import your to the EC2 instance as explained below in Import an SSL certificate from a certified authority:
If your SSL certificate is divided into separate key and certificate files, combine them into one PFX file.
The following example demonstrates how to combine your certificate and key. Run the commands below on the same machine on which the certificate is saved:
- Ensure that OpenSSL is installed on the machine using the following commands:
In the terminal window enter the following to view the OpenSSL details for the machine:
rpm -qa | grep -i openssl (rpm)
dpkg -l | grep -i openssl (deb)
In a command line window, enter
openssl version –a.
If OpenSSL is installed, the OpenSSL information, such as the date and version number, is displayed. Otherwise, download and install the latest version of OpenSSL.
- Run the following command:
openssl pkcs12 -export -out domain.name.pfx -inkey domain.name.key -in domain.name.crtThis command converts the key and certificate files into one PFX certificate.
Import the certificate to the EC2 instance as follows:
- In the terminal window, log in to your EC2 machine and change directory to:
./importCA.shto import the authorized certificate to the server.
Enter the current key store password (Default. password) and the password from the CA. This password is generated when creating the PFX file. The CA password becomes the new key store password. Store the password in a safe place for future access.
The CA password becomes the new key store password. Store the password in a safe place for future access.
- The script adds a private certificate to keyStoreHpmc and a public certificate to trustStoreHpmc.
- Restart the EC2 machine.
service UFTM restart
- Using your web browser, navigate to:
https://<Public IP address of your EC2 instance>:443/index.html
- Validate that the correct CA certificate is displayed in the browser.
Once you have set up your environment, use your testing tool to select devices, choose apps, and run the test.
Using your testing tool, open the UFT Mobile wizard which opens to the Device selection window.
- In the Choose Capabilities pane, make sure Amazon Lab is included in the Target Lab section.
- Choose a device based on your filter or rule.
- Click the App tab and select one or more apps.
- In the Test options tab, select Install to install the app on the device before running the test.
- Click SAVE AND CLOSE.
Start the test run from the testing tool. You may notice a delay the first time you run a test, because the device farm requires several minutes to allocate the device. To determine the state of your test, refer to the AWS Device Farm dashboard. A pending icon indicates a test in the Amazon queue, while the running icon indicates a test that is running.
Tip: If your test fails due to timeouts, add a Wait step to compensate for extra network activity.
When the test is actively running, you will be able to see the ADF device on the UFT Mobile console's Device tab. The remote device screen reviewer is not supported in this release, however you can view a video recording of the test. See Obtain logs for more details.
Note: The device ID of an ADF device has an AWS prefix.
You can track the project's progress on the EC2 console, under the AWS Device Farm service.
After a test run, you can download the connector log for the ADF host from the Amazon Device Farm test run page. In your ADF project Run & Sessions page, select the required test run. In the Files section, click Customer Artifacts to download a zip file with the logs. The connector logs are located in the Host_Machine_Files\$DEVICEFARM_LOG_DIR\log folder.
You can also download a video recording of the test from the Video section of the page.
You can use the ADF with a CI (Continuous integration) tool such as Jenkins using the UFT Mobile integration. For details, see the Automation Add-in Jenkins page.