Skip to content

Is It Possible to Collect Instruments .trace Files in AWS Device Farm for Appium iOS Tests?

0

I would like to know if it is currently possible to generate .trace files compatible with Xcode Instruments (e.g., Time Profiler, Allocations, CPU and Memory) when running iOS automated tests in AWS Device Farm.

Specifically:

  1. Can I initiate and collect Instruments traces (.trace) during execution of Appium + Java + Test NG Test Cases?
  2. Are there limitations or configurations required (e.g., use of custom test spec files)?
  3. Currently is this feature supported? a. only in custom environments or available also in the standard test configuration?

My goal is to retrieve performance data such as CPU and memory usage and analyze it using Instruments in AWS Device Farm.

asked 9 months ago81 views
1 Answer
0

Hello,

For iOS, you an collect performance metrics for automation runs using xctrace command. Currently, it will only be possible via custom test environment.

Implement following sample approach in test spec file to run xctrace:

      # To start instruments after launching WebdriverAgent:
      - xcrun xctrace record --device $DEVICEFARM_DEVICE_UDID_FOR_APPIUM --template 'Activity Monitor' --output $DEVICEFARM_LOG_DIR/appium.trace --time-limit 9000000ms --all-processes > $DEVICEFARM_LOG_DIR/trace.log 2>&1 &
      - echo $! > $DEVICEFARM_LOG_DIR/trace_pid.txt
      - cat $DEVICEFARM_LOG_DIR/trace_pid.txt
      - tail -f $DEVICEFARM_LOG_DIR/trace.log &
 
 
      # Then, at the end, terminate once and watch the log:
      - |-
        PID=$(cat $DEVICEFARM_LOG_DIR/trace_pid.txt)
        COUNT=0;
        MAX_COUNT=1800;
        kill -SIGINT $PID;
        while [[ $(cat $DEVICEFARM_LOG_DIR/trace.log | grep "Output file saved as" | wc -l) -lt 1 ]] && [[ $COUNT < $MAX_COUNT ]];
        do
          sleep 1;
          kill -SIGINT $PID;
          COUNT=$((COUNT + 1));
          echo "waiting...";
        done;
 

Please test this implementation in your testing environment

Sources
Custom test environments in AWS Device Farm - AWS Device Farm
Test environments in AWS Device Farm - AWS Device Farm

answered 9 months ago
AWS
SUPPORT ENGINEER
revised 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.