I'm using bitbucket pipelines to trigger test run in AWS device farm. While scheduling a test-run, I'm passing few parameters to device farm. I want to perform an API call (to update my build status in bitbucket) from my custom test environment spec using those parameters (passed while scheduling a test-run). I want to know how can I access those parameters in my custom test environment.
Schedule run command (where I'm passing the parameters at the end):
aws devicefarm schedule-run --project-arn ${DEVICE_FARM_PROJECT_ARN} --app-arn ${APP_ARN} --device-pool-arn ${ANDROID_DEVICEPOOL_ARN} --name "${BITBUCKET_BUILD_NUMBER}" --test type="APPIUM_JAVA_TESTNG",testPackageArn=${TEST_ARN},testSpecArn=${DEVICE_FARM_TEST_SPEC_ARN}, parameters={KeyName1=string,KeyName2=string}
Example of my test spec file:
version: 0.1
phases:
install:
commands:
- command
pre_test:
commands:
- command
test:
commands:
- command to test
post_test:
commands:
- command --> here I want to call bitbucket api to update my build status (using the parameters passed in 'schedule-run' command)
artifacts:
- location
- location
Currently, AWS Device Farm does not support passing environment variables on the ScheduleRun
API to the custom environment test spec file. However, you can dynamically generate the test spec file (using some YAML library) whenever you need to add / update environment variables to it, then re-upload it to the service.