在我的一个项目中,我们需要在AWS设备群中的多个设备上运行Appium测试脚本。这与AWS设备群上的正常测试案例略有不同。
如何在AWS设备群设备上持续运行Appium测试脚本?(至少达到AWS设备群中的150分钟限制)?测试脚本检查设备上预安装的应用程序,并按照测试脚本中指定的方式进行测试。
一旦测试脚本被触发,它应该运行很长时间,并执行脚本中提到的测试?通常,测试脚本将完成任务并提供输出,然后退出。但在这种情况下,我们需要测试脚本连续运行并执行测试。
发布于 2021-05-12 14:03:50
感谢你伸出援手。在AWS Device Farm中,我们提供了一种称为“自定义环境模式”的执行模式,允许您通过YAML规范文件定义如何使用真实的shell语法执行测试。
在下面的示例中,我将我们的Appium TestNG默认YAML文件的“测试”阶段,并将其修改为在循环中运行,将您所描述的需求转换为shell代码:
# 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;如果你需要更多关于定制你的simsjon@amazon.com文件或执行经验的帮助,请在YAML上联系我。
谢谢,乔恩
https://stackoverflow.com/questions/67200986
复制相似问题