Start Building for Free
CircleCI.comBlogCommunitySupport

emulator-wtf/emulator-wtf

A shareable package of CircleCI configuration to integrate with emulator-wtf, written by emulator-wtf

Community
  • Orb Quick Start Guide
  • Usage Examples
    • example-ew_api_token
    • example-oidc-token
  • Commands
  • Orb Source
  1. Orbs
  2. emulator-wtf/emulator-wtf@0.1.1

emulator-wtf/emulator-wtf@0.1.1

Sections
Emulator.wtf is an Android cloud emulator laser-focused on performance to deliver quick feedback to your PRs. With this orb you can easily run your Android instrumentation tests with emulator.wtf.
Created: January 6, 2026Version Published: May 25, 2026Releases: 6
Org Usage:
< 25
Homepage:
https://docs.emulator.wtf
Source:
https://www.github.com/emulator-wtf/circleci-orb

Orb Quick Start Guide

Use CircleCI version 2.1 at the top of your .circleci/config.yml file.

1 version: 2.1

Add the orbs stanza below your version, invoking the orb:

1 2 orbs: emulator-wtf: emulator-wtf/emulator-wtf@0.1.1

Use emulator-wtf elements in your existing workflows and jobs.

Opt-in to use of uncertified orbs on your organization’s Security settings page.

Usage Examples

example-ew_api_token

Run tests using emulator-wtf orb. Assumes a EW_API_TOKEN environment variable is set.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 version: '2.1' orbs: emulator-wtf: emulator-wtf/emulator-wtf@0.0.1 jobs: test-sample-app: docker: - image: cimg/openjdk:24.0 steps: - checkout - emulator-wtf/run_tests: app: sample-app.apk test: sample-test.apk workflows: test-workflow: jobs: - test-sample-app

example-oidc-token

Configure credentials and run tests using CircleCI OIDC authentication

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 version: '2.1' orbs: emulator-wtf: emulator-wtf/emulator-wtf@0.0.1 jobs: test_env_var_id: docker: - image: cimg/openjdk:24.0 steps: - checkout - emulator-wtf/configure_credentials: oidc_configuration_id: ${OIDC_CONFIGURATION_ID} - emulator-wtf/run_tests: app: sample-app.apk test: sample-test.apk test_hard_coded_id: docker: - image: cimg/openjdk:24.0 steps: - checkout - emulator-wtf/configure_credentials: oidc_configuration_id: asdf-1234-asdf-asdf - emulator-wtf/run_tests: app: sample-app.apk test: sample-test.apk workflows: test-workflow: jobs: - test_hard_coded_id - test_env_var_id

Commands

configure_credentials

Configure environment variable EW_API_TOKEN for emulator.wtf credentials

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
oidc_configuration_id
OIDC configuration ID as configured in emulator.wtf. Either provide hard-coded value (e.g asdf-213-asdf) or env variable (e.g ${OIDC_CONFIGURATION_ID}).
Required
OIDC configuration ID as configured in emulator.wtf. Either provide hard-coded value (e.g asdf-213-asdf) or env variable (e.g ${OIDC_CONFIGURATION_ID}).
Yes
-
type: string
string

run_tests

Run Android instrumentation tests using emulator.wtf.

Show command Source
PARAMETER
DESCRIPTION
REQUIRED
DEFAULT
TYPE
additional_apks
Additional apks to install, one per line
Additional apks to install, one per line
No
''
type: string
string
app
Path to application apk file
Required
Path to application apk file
Yes
-
type: string
string
cache_version
cache version, change this in case of cache corruption
cache version, change this in case of cache corruption
No
'1'
type: string
string
clear_package_data
Whether to clear app data between every test (requires use-orchestrator)
Whether to clear app data between every test (requires use-orchestrator)
No
false
type: boolean
boolean
devices
Device configurations to use, in the form of model=X,version=Y per line
Device configurations to use, in the form of model=X,version=Y per line
No
''
type: string
string
directories_to_pull
Directories to pull from device and store in outputs-dir, one per line
Directories to pull from device and store in outputs-dir, one per line
No
''
type: string
string
environment_variables
Environment variables to pass to AndroidJUnitRunner, comma-separated list of key-value pairs: key=value,key2=value2
Environment variables to pass to AndroidJUnitRunner, comma-separated list of key-value pairs: key=value,key2=value2
No
''
type: string
string
no_output_timeout
Elapsed time the run step may go without output. Accepts duration strings such as '20m', '1h', '500s'. If not set, uses the timeout parameter value when set, otherwise defaults to '15m'.
Elapsed time the run step may go without output. Accepts duration strings such as '20m', '1h', '500s'. If not set, uses the timeout parameter value when set, otherwise defaults to '15m'.
No
''
type: string
string
num_balanced_shards
Set to a number larger than 1 to split your tests into even shards based on historical runtime.
Set to a number larger than 1 to split your tests into even shards based on historical runtime.
No
0
type: integer
integer
num_shards
Set to a number larger than 1 to randomly split your tests into multiple shards to be executed in parallel
Set to a number larger than 1 to randomly split your tests into multiple shards to be executed in parallel
No
0
type: integer
integer
num_uniform_shards
Set to a number larger than 1 to randomly split your tests into multiple shards to be executed in parallel
Set to a number larger than 1 to randomly split your tests into multiple shards to be executed in parallel
No
0
type: integer
integer
outputs_dir
Location to store test outputs in
Location to store test outputs in
No
''
type: string
string
shard_target_runtime
Target runtime for each shard in minutes, tests will be split into shards targeting this runtime for each shard based on historical data on a best effort basis.
Target runtime for each shard in minutes, tests will be split into shards targeting this runtime for each shard based on historical data on a best effort basis.
No
0s
type: string
string
shard_unit
Configuration option to control sharding granularity. Can be set to test_classes to shard at the test class level, or test_methods to shard at the test method level. If not specified, ew-cli will use its default behavior.
Configuration option to control sharding granularity. Can be set to test_classes to shard at the test class level, or test_methods to shard at the test method level. If not specified, ew-cli will use its default behavior.
No
''
type: string
string
test
Path to test apk file
Required
Path to test apk file
Yes
-
type: string
string
test_cache
Whether to cache the test results
Whether to cache the test results
No
true
type: boolean
boolean
testcase_duration_hint
Hint for the average runtime for each test case expressed by a number followed by a unit (h, m, s or ms), with the maximum value being 3h and the minimum value being 1ms (default 10s). Useful when historical runtime data is missing for tests alongside with --shard-target-runtime
Hint for the average runtime for each test case expressed by a number followed by a unit (h, m, s or ms), with the maximum value being 3h and the minimum value being 1ms (default 10s). Useful when historical runtime data is missing for tests alongside with --shard-target-runtime
No
0s
type: string
string
timeout
Timeout for the test run, expressed as a number followed by a unit (h, m, s or ms). If not set, ew-cli will use its default timeout.
Timeout for the test run, expressed as a number followed by a unit (h, m, s or ms). If not set, ew-cli will use its default timeout.
No
''
type: string
string
use_orchestrator
Whether to use the Android Test Orchestrator
Whether to use the Android Test Orchestrator
No
false
type: boolean
boolean
version
ew-cli version to use
ew-cli version to use
No
1.3.2
type: string
string
with_coverage
Set to true to collect coverage files and save them to outputs-dir
Set to true to collect coverage files and save them to outputs-dir
No
false
type: boolean
boolean

Orb Source

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 # This code is licensed from CircleCI to the user under the MIT license. # See here for details: https://circleci.com/developer/orbs/licensing version: 2.1 description: | Emulator.wtf is an Android cloud emulator laser-focused on performance to deliver quick feedback to your PRs. With this orb you can easily run your Android instrumentation tests with emulator.wtf. display: home_url: https://docs.emulator.wtf source_url: https://www.github.com/emulator-wtf/circleci-orb commands: configure_credentials: description: Configure environment variable EW_API_TOKEN for emulator.wtf credentials parameters: oidc_configuration_id: description: OIDC configuration ID as configured in emulator.wtf. Either provide hard-coded value (e.g asdf-213-asdf) or env variable (e.g ${OIDC_CONFIGURATION_ID}). type: string steps: - run: command: |- #!/bin/bash set -euo pipefail if [ -n "${OIDC_CONFIGURATION_ID_PARAM:-}" ]; then CONF_ID=$(circleci env subst "${OIDC_CONFIGURATION_ID_PARAM}") fi if [ -z "${CONF_ID:-}" ]; then echo "Error: OIDC configuration ID is not set. Please configure ${OIDC_CONFIGURATION_ID_PARAM} environment variable." exit 1 fi TOKEN=$(circleci run oidc get --claims '{"aud":"api://emulator.wtf"}') RESPONSE=$(curl -w "\n%{http_code}" -X POST -H "Content-Type: application/json" -H "Accept: text/plain" -d "{\"oidcConfigurationUuid\":\"$CONF_ID\", \"oidcToken\":\"$TOKEN\"}" https://api.emulator.wtf/auth/oidc) HTTP_CODE=$(echo "$RESPONSE" | tail -n1) EW_API_TOKEN=$(echo "$RESPONSE" | head -n-1) if [ "$HTTP_CODE" -ge 400 ]; then echo "$EW_API_TOKEN" >&2 exit 1 fi echo "export EW_API_TOKEN=$EW_API_TOKEN" >> "$BASH_ENV" echo "EW_API_TOKEN configured successfully." environment: OIDC_CONFIGURATION_ID_PARAM: <<parameters.oidc_configuration_id>> name: Configure emulator.wtf Credentials run_tests: description: | Run Android instrumentation tests using emulator.wtf. parameters: additional_apks: default: "" description: Additional apks to install, one per line type: string app: description: Path to application apk file type: string cache_version: default: "1" description: cache version, change this in case of cache corruption type: string clear_package_data: default: false description: Whether to clear app data between every test (requires use-orchestrator) type: boolean devices: default: "" description: Device configurations to use, in the form of model=X,version=Y per line type: string directories_to_pull: default: "" description: Directories to pull from device and store in outputs-dir, one per line type: string environment_variables: default: "" description: 'Environment variables to pass to AndroidJUnitRunner, comma-separated list of key-value pairs: key=value,key2=value2' type: string no_output_timeout: default: "" description: Elapsed time the run step may go without output. Accepts duration strings such as '20m', '1h', '500s'. If not set, uses the timeout parameter value when set, otherwise defaults to '15m'. type: string num_balanced_shards: default: 0 description: Set to a number larger than 1 to split your tests into even shards based on historical runtime. type: integer num_shards: default: 0 description: Set to a number larger than 1 to randomly split your tests into multiple shards to be executed in parallel type: integer num_uniform_shards: default: 0 description: Set to a number larger than 1 to randomly split your tests into multiple shards to be executed in parallel type: integer outputs_dir: default: "" description: Location to store test outputs in type: string shard_target_runtime: default: 0s description: Target runtime for each shard in minutes, tests will be split into shards targeting this runtime for each shard based on historical data on a best effort basis. type: string shard_unit: default: "" description: Configuration option to control sharding granularity. Can be set to test_classes to shard at the test class level, or test_methods to shard at the test method level. If not specified, ew-cli will use its default behavior. type: string test: description: Path to test apk file type: string test_cache: default: true description: Whether to cache the test results type: boolean testcase_duration_hint: default: 0s description: Hint for the average runtime for each test case expressed by a number followed by a unit (h, m, s or ms), with the maximum value being 3h and the minimum value being 1ms (default 10s). Useful when historical runtime data is missing for tests alongside with --shard-target-runtime type: string timeout: default: "" description: Timeout for the test run, expressed as a number followed by a unit (h, m, s or ms). If not set, ew-cli will use its default timeout. type: string use_orchestrator: default: false description: Whether to use the Android Test Orchestrator type: boolean version: default: 1.3.2 description: ew-cli version to use type: string with_coverage: default: false description: Set to true to collect coverage files and save them to outputs-dir type: boolean steps: - restore_cache: keys: - ew-cli-<<parameters.cache_version>>-<<parameters.version>> - ew-cli-<<parameters.cache_version>> - run: command: | #!/bin/bash EW_BIN="$HOME/.cache/emulator-wtf/ew-cli" # download ew-cli wrapper if not fetched already if [[ ! -f "$EW_BIN" ]]; then mkdir -p ~/.cache/emulator-wtf curl -sL https://maven.emulator.wtf/releases/ew-cli -o "$EW_BIN" chmod a+x "$EW_BIN" fi # poke wrapper to fetch the jar if necessary $EW_BIN --version environment: EW_VERSION: <<parameters.version>> name: Fetch ew-cli - save_cache: key: ew-cli-<<parameters.cache_version>>-<<parameters.version>> paths: ~/.cache/emulator-wtf - run: command: |- #!/bin/bash EW_BIN="$HOME/.cache/emulator-wtf/ew-cli" args=("$EW_BIN") if [[ -n "$APP_APK" ]]; then args+=("--app" "$APP_APK") fi if [[ -n "$TEST_APK" ]]; then args+=("--test" "$TEST_APK") fi if [[ -n "$OUTPUTS_DIR" ]]; then args+=("--outputs-dir" "$OUTPUTS_DIR") fi if [[ -n "$DEVICES" ]]; then # shellcheck disable=SC2086 for device in $(echo $DEVICES | xargs); do args+=("--device" "$device") done fi if [[ "$USE_ORCHESTRATOR" == "1" ]]; then args+=("--use-orchestrator") fi if [[ "$CLEAR_PACKAGE_DATA" == "1" ]]; then args+=("--clear-package-data") fi if [[ "$WITH_COVERAGE" == "1" ]]; then args+=("--with-coverage") fi if [[ -n "$ADDITIONAL_APKS" ]]; then while IFS= read -r line ; do apk=$(echo "$line" | xargs) args+=("--additional-apks" "$apk") done \<<< "$ADDITIONAL_APKS" fi if [[ -n "$ENVIRONMENT_VARIABLES" ]]; then args+=("--environment-variables" "$ENVIRONMENT_VARIABLES") fi if [[ -n "$NUM_UNIFORM_SHARDS" ]]; then if [[ "$NUM_UNIFORM_SHARDS" != "0" ]]; then args+=("--num-uniform-shards" "$NUM_UNIFORM_SHARDS") fi fi if [[ -n "$SHARD_TARGET_RUNTIME" ]]; then if [[ "$SHARD_TARGET_RUNTIME" != "0s" ]]; then args+=("--shard-target-runtime" "$SHARD_TARGET_RUNTIME") fi fi if [[ -n "$TESTCASE_DURATION_HINT" ]]; then if [[ "$TESTCASE_DURATION_HINT" != "0s" ]]; then args+=("--testcase-duration-hint" "$TESTCASE_DURATION_HINT") fi fi if [[ -n "$SHARD_UNIT" ]]; then args+=("--shard-unit" "$SHARD_UNIT") fi if [[ -n "$NUM_BALANCED_SHARDS" ]]; then if [[ "$NUM_BALANCED_SHARDS" != "0" ]]; then args+=("--num-balanced-shards" "$NUM_BALANCED_SHARDS") fi fi if [[ -n "$NUM_SHARDS" ]]; then if [[ "$NUM_SHARDS" != "0" ]]; then args+=("--num-shards" "$NUM_SHARDS") fi fi if [[ -n "$DIRECTORIES_TO_PULL" ]]; then while IFS= read -r line ; do dirtopull=$(echo "$line" | xargs) args+=("--directories-to-pull" "$dirtopull") done \<<< "$DIRECTORIES_TO_PULL" fi if [[ "$TEST_CACHE" == "0" ]]; then args+=("--no-test-cache") fi if [[ -n "$TIMEOUT" ]]; then args+=("--timeout" "$TIMEOUT") fi echo "${args[@]}" # execute "${args[@]}" environment: ADDITIONAL_APKS: <<parameters.additional_apks>> APP_APK: <<parameters.app>> CLEAR_PACKAGE_DATA: <<parameters.clear_package_data>> DEVICES: <<parameters.devices>> DIRECTORIES_TO_PULL: <<parameters.directories_to_pull>> ENVIRONMENT_VARIABLES: <<parameters.environment_variables>> EW_VERSION: <<parameters.version>> NUM_BALANCED_SHARDS: <<parameters.num_balanced_shards>> NUM_SHARDS: <<parameters.num_shards>> NUM_UNIFORM_SHARDS: <<parameters.num_uniform_shards>> OUTPUTS_DIR: <<parameters.outputs_dir>> SHARD_TARGET_RUNTIME: <<parameters.shard_target_runtime>> SHARD_UNIT: <<parameters.shard_unit>> TEST_APK: <<parameters.test>> TEST_CACHE: <<parameters.test_cache>> TESTCASE_DURATION_HINT: <<parameters.testcase_duration_hint>> TIMEOUT: <<parameters.timeout>> USE_ORCHESTRATOR: <<parameters.use_orchestrator>> WITH_COVERAGE: <<parameters.with_coverage>> name: Run tests with emulator.wtf no_output_timeout: <<# parameters.no_output_timeout>><<parameters.no_output_timeout>><</parameters.no_output_timeout>><<^ parameters.no_output_timeout>><<# parameters.timeout>><<parameters.timeout>><</parameters.timeout>><<^ parameters.timeout>>15m<</parameters.timeout>><</parameters.no_output_timeout>> examples: example-ew_api_token: description: | Run tests using emulator-wtf orb. Assumes a EW_API_TOKEN environment variable is set. usage: version: "2.1" orbs: emulator-wtf: emulator-wtf/emulator-wtf@0.0.1 jobs: test-sample-app: docker: - image: cimg/openjdk:24.0 steps: - checkout - emulator-wtf/run_tests: app: sample-app.apk test: sample-test.apk workflows: test-workflow: jobs: - test-sample-app example-oidc-token: description: | Configure credentials and run tests using CircleCI OIDC authentication usage: version: "2.1" orbs: emulator-wtf: emulator-wtf/emulator-wtf@0.0.1 jobs: test_env_var_id: docker: - image: cimg/openjdk:24.0 steps: - checkout - emulator-wtf/configure_credentials: oidc_configuration_id: ${OIDC_CONFIGURATION_ID} - emulator-wtf/run_tests: app: sample-app.apk test: sample-test.apk test_hard_coded_id: docker: - image: cimg/openjdk:24.0 steps: - checkout - emulator-wtf/configure_credentials: oidc_configuration_id: asdf-1234-asdf-asdf - emulator-wtf/run_tests: app: sample-app.apk test: sample-test.apk workflows: test-workflow: jobs: - test_hard_coded_id - test_env_var_id
Developer Updates
Get tips to optimize your builds
Or join our research panel and give feedback
By submitting this form, you are agreeing to ourTerms of UseandPrivacy Policy.