Reputation: 31
In one of my projects, we need to run an Appium test script on multiple devices on AWS device farm. This is a little bit different from normal test cases on the AWS device farm.
How can we run the Appium test script continuously on the AWS device farm devices? (atleast up to the 150 mins limit in AWS device farm)? The test script checks for a pre-installed application on the device and does the test as specified in the test script.
Once the test script is triggered, it should run for a long time and do the test mentioned in the script? Normally, the test script will do the task and provide the output, and then exit. But in this case, we need the test script to run continuously and perform the test.
Upvotes: 0
Views: 373
Reputation: 119
Thank you for reaching out. In AWS Device Farm, we offer an execution mode called "Custom environment mode" which allows you to define how your test will be executed with real shell syntax via a YAML spec file.
In the following example, I take our Appium TestNG default YAML file's "test" phase, and alter it to run in a loop with the requirements you describe translated to shell code:
# The test phase includes commands that start your test suite execution.
test:
commands:
# max_duration should be a few minutes less than the Device Farm test timeout
# For example, for a 150 minute test, we will time out internally after 140 mins
- max_duration=8400
- test_start_time=$(date +%s)
- test_duration=0
- cd $DEVICEFARM_TEST_PACKAGE_PATH
- >-
while [ "$test_duration" -le "$max_duration" ];
do
java -Dappium.screenshots.dir=$DEVICEFARM_SCREENSHOT_PATH org.testng.TestNG -testjar *-tests.jar -d $DEVICEFARM_LOG_DIR/test-output -verbose 10;
test_duration=$(($(date +%s)-test_start_time));
done;
Reach out to me at [email protected] if you need any more help customizing your YAML file or execution experience in general.
Thanks, Jon
Upvotes: 1