Using Provar with Amazon Web Services (AWS) Device Farm
If you develop new mobile-optimized applications, you know that the testing process throughout the development lifecycle is exponentially more challenging, given the wide range of mobile devices that your end-users may be operating to access your app.
That’s why more leading organizations are turning to the Amazon Web Services Device Farm to help streamline the testing process by helping you test your application on a shared fleet of 2500+ devices remotely in the cloud. (We get it. The cube next to you probably isn’t big enough to charge that many phones.)
With Provar, you can create a wide range of testing scenarios and rapidly reapply those tests by integrating those tests with the Amazon Web Services Device Farm. (Side note, we also support testing via several remote web and mobile testing platforms such as Sauce Labs, Perfecto, and BrowserStack.)
If you’d like to use Provar in conjunction with the AWS Device Farm, you can use the following information to run Provar test cases on various Android devices (that use a Chrome browser) within the AWS Device Farm. You can also check out the AWS Device Farm documentation on the Salesforce website to learn more.
Prerequisites in Amazon Web Service (a.k.a. Things you need)
- An AWS console account.
- A Provar ANT zip file.
- A Provar project with at least one test case.
Setting up your Folder Structure to Execute Test Cases in the Device Farm
Since the AWS Device Farm is designed to conceal the web driver, you will need to upload the project in an AWS Device Farm in a zip format.
For that, you will need to create a folder structure using the steps below:
(1) Create a folder (e.g. ProvarProject).
(2) Add the project folder, the Provar_ANT folder, and the license file in the ProvarProject folder. Rename the license file with the name ProvarLicense.properties.
(3) In the project folder, there are test cases in the tests folder, build.xml, ANT folder, and the .testproject file containing settings for Appium.
(4) Using ANT build.xml, execute your test cases.
(5) The Provar_ANT folder contains all of your required jar files.
(6) Create a zip file of ProvarProject.
Configuring Your Settings
You can configure the settings in a couple of different ways. You can either use the Provar UI or update the build.xml file and the .testproject file.
(1) In the build.xml, a few changes are required.
Change provar.home where the Provar_ANT directory is available.
<property name="provar.home" value="../../Provar_ANT"/>
Change ProviderName (same as mentioned in .testproject) and DeviceName (any name) in the Run-Test-Case tag.
webBrowserProviderName="SampleProviderForDevice" webBrowserDeviceName="Google Pixel 2"
(2) In the .testproject file, select the browserProvider (same as ProviderName in build.xml). The values mentioned in PINK are mandatory fields and should have the same value as shown below.
<browserProvider name="SampleProviderForDevice" type="Appium"> <devices> <browserProviderDevice name="Google Pixel 2" platform="ANDROID"> <properties> <browserPlatformProperty name="deviceName" type="DesiredCapability" value="Google Pixel 2"/> <browserPlatformProperty name="platformName" type="DesiredCapability" value="ANDROID"/> <browserPlatformProperty name="platformVersion" type="DesiredCapability" value="9"/> <browserPlatformProperty name="udid" type="DesiredCapability" value="deviceUDID"/> </properties> </browserProviderDevice> </devices> <properties> <browserPlatformProperty name="gridUrl" value="http://127.0.0.1:4723/wd/hub"/> <browserPlatformProperty name="newCommandTimeout" type="DesiredCapability" value="100"/> </properties> </browserProvider>
Note: deviceUDID parameter will be replaced by the actual device UDID at run time.
How to Execute Test Cases
(1) Sign in to your AWS console and navigate the AWS Device Farm.
(2) Create a project in the AWS Device Farm console.
(3) In automated tests, select Create a new run button.
(4) Choose the web application, provide a name, and click Next Step.
(5) In Configure Steps, select the Appium Node.js test type.
(6) Click on the Upload button and upload the ProvarProject.zip file.
(7) Once the project is uploaded, specify the spec file. See the spec file below.
version: 0.1 # Phases are collection of commands that get executed on Device Farm. phases: # The install phase includes commands that install dependencies that your tests use. # Default dependencies for testing frameworks supported on Device Farm are already installed. install: commands: # By default, Appium server version used is 1.7.2. # You can switch to an alternate supported version from 1.6.5, 1.7.1, 1.7.2, 1.8.0 , 1.8.1, 1.9.1 by using a command like "avm 1.7.1" # OR # To install a newer version of Appium use the following commands: - export APPIUM_VERSION=1.9.1 - avm $APPIUM_VERSION - ln -s /usr/local/avm/versions/$APPIUM_VERSION/node_modules/.bin/appium /usr/local/avm/versions/$APPIUM_VERSION/node_modules/appium/bin/appium.js - java -version - ant -version - export PROVAR_HOME=$DEVICEFARM_TEST_PACKAGE_PATH - cd $DEVICEFARM_TEST_PACKAGE_PATH - mkdir -p /home/device-farm/Provar/.licenses - mv $DEVICEFARM_TEST_PACKAGE_PATH/ProvarProject/ProvarLicense.properties /home/device-farm/Provar/.licenses # The pre-test phase includes commands that setup your test environment. pre_test: commands: # We recommend starting appium server process in the background using the command below. # Appium server log will go to $DEVICEFARM_LOG_DIR directory. # The environment variables below will be auto-populated during run time. - echo "Start appium server" - >- appium --log-timestamp --browser-name Chrome --device-name $DEVICEFARM_DEVICE_NAME --platform-name $DEVICEFARM_DEVICE_PLATFORM_NAME --udid $DEVICEFARM_DEVICE_UDID --chromedriver-executable $DEVICEFARM_CHROMEDRIVER_EXECUTABLE >> $DEVICEFARM_LOG_DIR/appiumlog.txt 2>&1 & - >- start_appium_timeout=0; while [ true ]; do if [ $start_appium_timeout -gt 60 ]; then echo "appium server never started in 60 seconds. Exiting"; exit 1; fi; grep -i "Appium REST http interface listener started on 0.0.0.0:4723" $DEVICEFARM_LOG_DIR/appiumlog.txt >> /dev/null 2>&1; if [ $? -eq 0 ]; then echo "Appium REST http interface listener started on 0.0.0.0:4723"; break; else echo "Waiting for appium server to start. Sleeping for 1 second"; sleep 1; start_appium_timeout=$((start_appium_timeout+1)); fi; done; # The test phase includes commands that run your test suite execution. test: commands: # Go into the root folder containing your source code - echo "Navigate to test source code" - cd $DEVICEFARM_TEST_PACKAGE_PATH - echo "Start Provar/Appium test" - sed -i "s/deviceUDID/$DEVICEFARM_DEVICE_UDID/g" ProvarProject/Project/.testproject # Enter the command below to start the tests . The comamnd should be similar to what you use to run the tests locally. - cd ProvarProject/Project/ANT - ant # The post test phase includes are commands that are run after your tests are executed. post_test: commands: # The artifacts phase lets you specify the location where your tests logs, device logs will be stored. # And also let you specify the location of your test logs and artifacts which you want to be collected by Device Farm. # These logs and artifacts will be available through ListArtifacts API in Device Farm. artifacts: # By default, Device Farm will collect your artifacts from following directories - $DEVICEFARM_LOG_DIR - $DEVICEFARM_TEST_PACKAGE_PATH/ProvarProject/Project/ANT/
8) Create a new device pool and add devices to it.
(9) After selecting Device Pool, click the Next Step button.
(10) Click the Confirm and Start Run button.
(11) Check the status of the test execution using the links shown below.
Getting those Reports You Need
The AWS Device Farm provides many options (like Video, Test Specification log, Files, and Screenshots) to verify your test execution status. And it stores your reports for up to 400 days. These reports include metadata, logs, screenshots, and performance data.
(1) Video – It records the executive session on each device.
(2) Suites – These provide different types of status. Also, you can get the execution timings at the suite level.
(3) Log files.
- Provar Automation
- Installing Provar Automation
- Updating Provar Automation
- Using Provar Automation
- API Testing
- Behavior-Driven Development
- Creating and Importing Projects
- Creating Test Cases
- Custom Table Mapping
- Functions
- Debugging Tests
- Defining a Namespace Prefix on a Connection
- Defining Proxy Settings
- Environment Management
- Exporting Test Cases into a PDF
- Exporting Test Projects
- Override Auto-Retry for Test Step
- Managing Test Steps
- Namespace Org Testing
- NitroX
- Provar Desktop
- Provar Test Builder
- Refresh and Recompile
- Reintroduction of CLI License Check
- Reload Org Cache
- Reporting
- Running Tests
- Searching Provar with Find Usages
- Secrets Management and Encryption
- Setup and Teardown Test Cases
- Tags and Service Level Agreements (SLAs)
- Test Cycles
- Test Plans
- Testing Browser Options
- Tooltip Testing
- Using the Test Palette
- Using Custom APIs
- Callable Tests
- Data-Driven Testing
- Page Objects
- Block Locator Strategies
- Introduction to XPaths
- Creating an XPath
- JavaScript Locator Support
- Label Locator Strategies
- Maintaining Page Objects
- Mapping Non-Salesforce fields
- Page Object Operations
- ProvarX™
- Refresh and Reselect Field Locators in Test Builder
- Using Java Method Annotations for Custom Objects
- Applications Testing
- Provar Manager
- DevOps
- Introduction to Test Scheduling
- Apache Ant
- Configuration for Sending Emails via the Automation Command Line Interface
- Continuous Integration
- AutoRABIT Salesforce DevOps in Provar Test
- Azure DevOps
- Running a Provar CI Task in Azure DevOps Pipelines
- Configuring the Automation secrets password in Microsoft Azure Pipelines
- Parallel Execution in Microsoft Azure Pipelines using Multiple build.xml Files
- Parallel Execution in Microsoft Azure Pipelines using Targets
- Parallel execution in Microsoft Azure Pipelines using Test Plans
- Bitbucket Pipelines
- CircleCI
- Copado
- Docker
- Flosum
- Gearset DevOps CI/CD
- GitHub Actions
- Integrating GitHub Actions CI to Run Automation CI Task
- Remote Trigger in GitHub Actions
- Parameterization using Environment Variables in GitHub Actions
- Parallel Execution in GitHub Actions using Multiple build.xml Files
- Parallel Execution in GitHub Actions using Targets
- Parallel Execution in GitHub Actions using Test Plan
- Parallel Execution in GitHub Actions using Job Matrix
- GitLab Continuous Integration
- Travis CI
- Jenkins
- Execution Environment Security Configuration
- Provar Jenkins Plugin
- Parallel Execution
- Running Provar on Linux
- Reporting
- Salesforce DX
- Git
- Team Foundation Server
- Version Control
- Salesforce Testing
- Best Practices
- Troubleshooting
- Release Notes