'I am getting an issue while scheduling a run in AWS Device Farm from CLI

I am using this command for executing from CLI -

aws devicefarm schedule-run --project-arn "project-arm value" --app-arn "app-arm value" --device-pool-arn "device-pool-arm value" --name "Automated_script" --test '{"type":"APPIUM_JAVA_TESTNG","testPackageArn":"testPackageArn value"}'

But getting this error

An error occurred (ArgumentException) when calling the ScheduleRun operation: Missing or unprocessed resources.



Solution 1:[1]

To Schedule a run, you need to do the following steps:

  1. [One time setup] Call aws devicefarm create-project to create a project for all your tests
  2. Call aws devicefarm create-upload for your application under test
  3. Upload your application to the pre-signed URL returned by create-upload
  4. Call aws devicefarm create-upload for your test scripts
  5. Upload your test scripts to the pre-signed URL returned by create-upload
  6. After your uploads have been processed by Device Farm, call aws devicefarm schedule-run

Normally when you see "An error occurred (ArgumentException) when calling the ScheduleRun operation: Missing or unprocessed resources.", it means you forgot step 3 or step 5. You can upload your application to the pre-signed URL using curl. You can check whether your upload has been successfully processed by calling aws devicefarm get-upload.

Here is an example blog post which uses the AWS CLI to schedule a run: Get started with the AWS Device Farm CLI

Solution 2:[2]

Double-check all of your ARNs with a bash script:

PROJECT_ARN=<paste project ARN here>
APP_ARN=<paste app ARN here>
<define other ARNs here>

#Verify ARNs
aws devicefarm get-project --arn $PROJECT_ARN
aws devicefarm get-upload --arn $APP_ARN
aws devicefarm get-upload --arn $TEST_PACKAGE_ARN
aws devicefarm get-upload --arn $TEST_YAML_ARN
aws devicefarm get-device-pool --arn $DEVICE_POOL_ARN
aws devicefarm get-vpce-configuration --arn $VPCE_CONFIG_ARN

Our mistake was that one of our ARNs was for a test file which hadn't been uploaded, note the status initialized, not completed:

 ...
 "status": "INITIALIZED", 
            "category": "PRIVATE", 
            "contentType": "application/octet-stream", 
            "name": "googlePlayProdDebug-UITest-debug.apk", 
            ...

Another mistake was trying to use a device pool which was not a part of our project. Device pools are specific to projects.

Try: aws devicefarm list-device-pools --arn <projectARN>

Solution 3:[3]

I had the same issue, in my case the "type" was wrong. My project is JNUIT

  • Before: --test type=APPIUM_JAVA_TESTNG
  • After: --test type=APPIUM_JAVA_JUNIT

aws devicefarm schedule-run --project-arn $PROJECT_ARN --app-arn $APP_UPLOAD_ARN --device-pool-arn $DEVICE_POOL_ARN --name customTestName --test type=APPIUM_JAVA_JUNIT,testPackageArn=$TESTS_UPLOAD_ARN

Solution 4:[4]

My issue was invalid yaml file used for testSpecArn You can check its validity with yamllint, this is how:

  • install yamlling with homebrew: brew install yamllint
  • go to directory where you yaml file is
  • run yamllint .

If there are issues with your yaml file they will be described in terminal as errors, with red color.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Michael Willingham
Solution 2
Solution 3 Renato Coutinho
Solution 4