Swarmer
is a replacement for such bash scripts but with features like:
config.ini
that'll be applied to created emulator.Swarmer
shipped as jar
, so just run it java -jar swarmer.jar options
.
Dependencies:
java -jar swarmer.jar start …
--emulator-name
test_emulator_1
.--package
avdmanager create avd --package
.--android-abi
google_apis/x86_64
.--path-to-config-ini
config.ini
for created emulator.config.ini
is to create AVD on your machine using Android Studio and then copy config from ~/.android/avd/device_name.avd/config.ini
.config.ini
in version control so your team members could review it and builds will be reproducible.--help, -help, help, -h
--emulator-start-options
emulator -avd \$emulatorName
command, i.e. --no-window -prop persist.sys.language=en -prop persist.sys.country=US
.--emulator-start-timeout-seconds
--redirect-logcat-to
--keep-existing-avds
java -jar swarmer.jar start \
--emulator-name test_emulator_1 \
--package "system-images;android-25;google_apis;x86" \
--android-abi google_apis/x86_64 \
--path-to-config-ini emulator_config.ini \
--emulator-start-options -prop persist.sys.language=en -prop persist.sys.country=US \
--redirect-logcat-to test_emulator_1_logcat.txt
java -jar swarmer.jar start \
--emulator-name test_emulator_1 \
--package "system-images;android-25;google_apis;x86" \
--android-abi google_apis/x86_64 \
--path-to-config-ini emulator_config1.ini \
--emulator-start-options -prop persist.sys.language=en -prop persist.sys.country=US \
--redirect-logcat-to test_emulator_1_logcat.txt \
--emulator-name test_emulator_2 \
--package "system-images;android-23;google_apis;x86" \
--android-abi google_apis/x86_64 \
--path-to-config-ini emulator_config2.ini \
--emulator-start-options -prop persist.sys.language=en -prop persist.sys.country=US \
--redirect-logcat-to test_emulator_2_logcat.txt
java -jar swarmer.jar start \
--emulator-name test_emulator_1 \
--android-target android-25 \
--android-abi google_apis/x86_64 \
--path-to-config-ini emulator_config.ini \
--emulator-start-options -prop persist.sys.language=en -prop persist.sys.country=US \
--redirect-logcat-to test_emulator_1_logcat.txt
java -jar swarmer.jar start \
--emulator-name test_emulator_2 \
--package "system-images;android-23;google_apis;x86" \
--android-abi google_apis/x86_64 \
--path-to-config-ini emulator_config2.ini \
--emulator-start-options -prop persist.sys.language=en -prop persist.sys.country=US \
--redirect-logcat-to test_emulator_2_logcat.txt
java -jar swarmer.jar stop …
--timeout
java -jar swarmer.jar stop --timeout 10
Swarmer is available on jcenter.
You can download it in your CI scripts or store it in your version control system (not recommended).
SWARMER_VERSION=some-version
curl --fail --location https://jcenter.bintray.com/com/gojuno/swarmer/swarmer/${SWARMER_VERSION}/swarmer-${SWARMER_VERSION}.jar --output /tmp/swarmer.jar
All the releases and changelogs can be found on Releases Page.
Swarmer works great in combination with Composer — another tool we've built at Juno.
Composer can run Android Instrumentation tests in parallel on multiple connected devices/emulators. In our CI Pipeline we start emulators with Swarmer and then Composer runs tests on them.
Dependencies: you only need docker
and bash
installed on your machine.
bash ci/build.sh
Copyright 2017 Juno, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.