如何在 AWS-Device Farm 中获得更精细的测试结果? [Appium node.js]

How can I get more granular Testresults in AWS-Device Farm? [Appium node.js]

我 运行 Appium node.js 在 AWS Device Farm 上进行测试。我想获得 Device Farm 中显示的精细测试结果,但我总是得到一个包含所有测试的 "Tests Suite" 结果。因此,如果一个小测试失败,则整个测试套件都会失败。 我在 Device Farm 文档中读到,在标准环境中将显示更精细的结果,但我不确定如何切换或使用标准环境。我认为它与 YAML 文件有关,因为 Device Farm UI 不再提供在标准或自定义环境之间 select 的可能性。

这是我当前的 YAML 文件:

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

      # By default the node version installed is 11.4.0
      # you can switch to an alternate node version using below command.
      # - nvm install 10.13.0

      # Unpackage and install the node modules that you uploaded in the test phase.
      - echo "Navigate to test package directory"
      - cd $DEVICEFARM_TEST_PACKAGE_PATH
      - npm install *.tgz

  # 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 --device-name $DEVICEFARM_DEVICE_NAME
        --platform-name $DEVICEFARM_DEVICE_PLATFORM_NAME --app $DEVICEFARM_APP_PATH
        --automation-name UiAutomator2 --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 and node_modules
      - echo "Navigate to test source code"
      # Change the directory to node_modules folder as it has your test code and the dependency node modules.
      - cd $DEVICEFARM_TEST_PACKAGE_PATH/node_modules/*

      - echo "Start Appium Node test"
      # Enter the command below to start the tests . The comamnd should be similar to what you use to run the tests locally.
      # For e.g. assuming you run your tests locally using command "node YOUR_TEST_FILENAME.js.", enter the same command below:
      - npm run test:android

  # 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``` 

AWS Device Farm 的标准模式独立于 YAML 文件。当您通过控制台或通过 CLI 通过 ScheduleRun API 安排 运行 时,它是在 "Configure" 步骤中配置的设置。目前,AWS Device Farm 不支持标准模式下的 Appium 节点,这意味着您寻求的粒度报告不可用。

如果您还有其他问题,可以前往 AWS Device Farm Forums 寻求他们工程团队的额外帮助。

安迪