Code Monkey home page Code Monkey logo

composer's Introduction

Composer — Reactive Android Instrumentation Test Runner.

Composer is a modern reactive replacement for square/spoon with following feature set:

  • Parallel test execution on multiple emulators/devices with test sharding support.
  • Logcat output capturing per test and for whole test run as well.
  • Screenshots and files pulling for each test reactively (with support for square/spoon folder structure).
  • JUnit4 report generation.

Demo

Table of Contents

Why we've decided to replace square/spoon

Problem 1: Our UI tests are stable, but we saw a lot of UI tests build failures. About ~50% of our CI builds were failing. All such failures of UI tests came from Spoon not being able to run tests on one or more emulators (device is red in the report and error message is …work/emulator-5554/result.json (No such file or directory), basically it timed out on installing the apk on a device, increasing adb timeout did not help, all emulators responded to adb commands and mouse/keyboard interactions, we suppose problem is in in ddmlib used by Spoon.

Solution: Composer does not use ddmlib and talks to emulators/devices by invoking adb binary.

Problem 2: Pretty often when test run finished, Spoon freezed on moving screenshots from one of the emulators/devices. Again, we blame ddmlib used in Spoon for that.

Solution: Composer invokes adb binary to pull files from emulators/devices, we haven't seen problems with that in more than 700 builds on CI.

Problem 3: Spoon pulled screenshots/files after finish of the whole test run on a device which slows down builds: test_run_time + pull_files_time.

Solution: Composer pulls screenshots/files reactively after each test which basically leads to: ~test_run_time.

Problem 4: If test sharding is enabled (which we do all the time), Spoon HTML report is very hard to look at, especially if you want to find some particular test(s) and it's not failed. You have to either hover mouse over each test to find out its name or go into html/xml source and find on which emulator/device test was sharded in order to click on correct device and then find test by CMD+F on the page.

Solution: HTML report we've built designed with usability and performance in mind.

Problem 5: Html report can be very slow to load if you have lots of screenshots (which we do) since it displays all the screenshots of tests that were run on a particular device on a single page — it can take up to minutes to finish while you effectively unable to scroll page since scroll is jumping up and down each time new screenshot loaded.

Solution: HTML report that we've built does not display screenshots on index and suite pages, screenshots are displayed only on the test page → fast page load.

With Composer we were able to make UI tests required part of CI for Pull Requests. It's fast, reliable and uses RxJava which means that it's relatively easy to add more features combining complex async transformations.

HTML Report

Our Frontend Team helped us build HTML Report for the Composer.

It's fast, small and designed in collaboration with our QAs and Developers who actually use it on daily basis to make it easy to use.

Here are few screenshots:

Suite Page Test PageTest Page

Usage

Composer shipped as jar, to run it you need JVM 1.8+: java -jar composer-latest-version.jar options.

Supported options

Required
  • --apk
    • Either relative or absolute path to application apk that needs to be tested.
    • Example: --apk myapp.apk
  • --test-apk
    • Either relative or absolute path to apk with tests.
    • Example: --test-apk myapp-androidTest.apk
Optional
  • --help, -help, help, -h
    • Print help and exit.
  • --test-runner
    • Fully qualified name of test runner class you're using.
    • Default: automatically parsed from --test-apk's AndroidManifest.
    • Example: --test-runner com.example.TestRunner
  • --shard
    • Either true or false to enable/disable test sharding which statically shards tests between available devices/emulators.
    • Default: true.
    • Example: --shard false
  • --output-directory
    • Either relative or absolute path to directory for output: reports, files from devices and so on.
    • Default: composer-output in current working directory.
    • Example: --output-directory artifacts/composer-output
  • --instrumentation-arguments
    • Key-value pairs to pass to Instrumentation Runner.
    • Default: empty.
    • Example: --instrumentation-arguments myKey1 myValue1 myKey2 myValue2.
  • --verbose-output
    • Either true or false to enable/disable verbose output for Composer.
    • Default: false.
    • Example: --verbose-output true
  • --keep-output-on-exit
    • Either true or false to keep/clean temporary output files used by Composer on exit.
    • Default: false.
    • Composer uses files to pipe output of external commands like adb, keeping them might be useful for debugging issues.
    • Example: --keep-output-on-exit true
  • --devices
    • Connected devices/emulators that will be used to run tests against.
    • Default: empty, tests will run on all connected devices/emulators.
    • Specifying both --devices and --device-pattern will result in an error.
    • Example: --devices emulator-5554 emulator-5556
  • --device-pattern
    • Connected devices/emulators that will be used to run tests against.
    • Default: empty, tests will run on all connected devices/emulators.
    • Specifying both --device-pattern and --devices will result in an error.
    • Example: --device-pattern "emulator.+"
  • --install-timeout
    • APK installation timeout in seconds.
    • Default: 120 seconds (2 minutes).
    • Applicable to both test APK and APK under test.
    • Example: --install-timeout 20
  • --fail-if-no-tests
    • Either true or false to enable/disable error on empty test suite.
    • Default: true.
    • False may be applicable when you run tests conditionally(via annotation/package filters) and empty suite is a valid outcome.
    • Example: --fail-if-no-tests false
  • --with-orchestrator
  • --extra-apks
    • Apks to be installed for utilities. What you would typically declare in gradle as androidTestUtil
    • Default: empty, only apk and test apk would be installed.
    • Works great with Orchestrator to install orchestrator & test services APKs.
    • Example: --extra-apks path/to/apk/first.apk path/to/apk/second.apk
Example

Simplest :

java -jar composer-latest-version.jar \
--apk app/build/outputs/apk/example-debug.apk \
--test-apk app/build/outputs/apk/example-debug-androidTest.apk

With arguments :

java -jar composer-latest-version.jar \
--apk app/build/outputs/apk/example-debug.apk \
--test-apk app/build/outputs/apk/example-debug-androidTest.apk \
--test-runner com.example.test.ExampleTestRunner \
--output-directory artifacts/composer-output \
--instrumentation-arguments key1 value1 key2 value2 \
--verbose-output false \
--keep-output-on-exit false \
--with-orchestrator false

Download

Composer is available on jcenter.

You can download it in your CI scripts or store it in your version control system (not recommended).

COMPOSER_VERSION=some-version
curl --fail --location https://jcenter.bintray.com/com/gojuno/composer/composer/${COMPOSER_VERSION}/composer-${COMPOSER_VERSION}.jar --output /tmp/composer.jar

All the releases and changelogs can be found on Releases Page.

3rd-party Composer Gradle Plugin

@trevjonez built 🎉 Gradle Plugin for Composer which allows you to configure and run Composer with Gradle.

Swarmer

Composer works great in combination with Swarmer — another tool we've built at Juno.

Swarmer can create and start multiple emulators in parallel. In our CI Pipeline we start emulators with Swarmer and then Composer runs tests on them.

How to build

All-in-one script (used in Travis build)

Dependencies: docker and bash.

ci/build.sh

Build Composer

Environment variable ANDROID_HOME must be set.

./gradlew build

Build HTML report module

Dependencies: npm and nodejs.

cd html-report
npm install
npm build

License

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.

composer's People

Contributors

artem-zinnatullin avatar arturdryomov avatar bernatpl avatar christopherperry avatar cristiangm avatar dmitry-novikov avatar dsvoronin avatar handstandsam avatar jonas-m- avatar jurenovic avatar kazucocoa avatar koral-- avatar ming13 avatar navstyachka avatar nilzor avatar pivotal-james-zcheng avatar plastiv avatar tagantroy avatar yunikkk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

composer's Issues

Parallelize HTML report generation.

Currently we're generating all html report files one by one, this is slow because logcat processing takes a lot of time, we need to parallelize this with Rx.

NumberFormatException while running tests with composer

When trying to run the tests while using the composer jar file (v 0.2.2), i get a NumberFormatException. The issue is being caused from the Intrumentation.kt class at line 62 when trying to convert the string to integer:
Error trying to convert "numtests" into integer >
numTests = str.parseInstrumentationStatusValue("numtests").toInt()

https://github.com/gojuno/composer/blob/master/composer/src/main/kotlin/com/gojuno/composer/Instrumentation.kt

See below screenshot for more details. The command used to run the tests can be seen in the screenshot. Also, our project is using RxJava 1.x if that helps. If you would like a log file of the error, then please let me know.
screen shot 2017-06-28 at 6 03 49 pm

*.output files are stored in project root

Despite of --output-directory param being set.
1319384247846811.output and similar files, containing
Script started on Tue Apr 11 15:01:33 2017 command: /Users/dmitryyunitsky/Library/Android/sdk/platform-tools/adb devices List of devices attached

Unexpected Start code in second entry.

One run ended with the following :

java -jar ci/internal/composer.jar --apk ./app/build/outputs/apk/XXX.apk --test-apk app/build/outputs/apk/XXX-debug-androidTest.apk --test-package com.gojuno.driver.dev.test --test-runner android.support.test.runner.JunoAndroidRunner --output-directory artifacts/coffeetray-output --instrumentation-arguments retryUiTests true reportFailuresToCrashlytics true
[Tue Apr 11 09:41:22 UTC 2017]: 6 connected adb device(s): [AdbDevice(id=emulator-5564, online=true), AdbDevice(id=emulator-5562, online=true), AdbDevice(id=emulator-5560, online=true), AdbDevice(id=emulator-5558, online=true), AdbDevice(id=emulator-5556, online=true), AdbDevice(id=emulator-5554, online=true)]
[Tue Apr 11 09:41:22 UTC 2017]: [emulator-5564] Installing apk... pathToApk = ./app/build/outputs/apk/XXX.apk
[Tue Apr 11 09:41:22 UTC 2017]: [emulator-5562] Installing apk... pathToApk = ./app/build/outputs/apk/XXX.apk
[Tue Apr 11 09:41:22 UTC 2017]: [emulator-5560] Installing apk... pathToApk = ./app/build/outputs/apk/XXX.apk
[Tue Apr 11 09:41:22 UTC 2017]: [emulator-5558] Installing apk... pathToApk = ./app/build/outputs/apk/XXX.apk
[Tue Apr 11 09:41:22 UTC 2017]: [emulator-5556] Installing apk... pathToApk = ./app/build/outputs/apk/XXX.apk
[Tue Apr 11 09:41:22 UTC 2017]: [emulator-5554] Installing apk... pathToApk = ./app/build/outputs/apk/XXX.apk
[Tue Apr 11 09:41:25 UTC 2017]: [emulator-5558] Successfully installed apk in 3 seconds, pathToApk = ./app/build/outputs/apk/XXX.apk
[Tue Apr 11 09:41:25 UTC 2017]: [emulator-5558] Installing apk... pathToApk = app/build/outputs/apk/XXX-debug-androidTest.apk
[Tue Apr 11 09:41:25 UTC 2017]: [emulator-5556] Successfully installed apk in 3 seconds, pathToApk = ./app/build/outputs/apk/XXX.apk
[Tue Apr 11 09:41:25 UTC 2017]: [emulator-5556] Installing apk... pathToApk = app/build/outputs/apk/XXX-debug-androidTest.apk
[Tue Apr 11 09:41:26 UTC 2017]: [emulator-5554] Successfully installed apk in 3 seconds, pathToApk = ./app/build/outputs/apk/XXX.apk
[Tue Apr 11 09:41:26 UTC 2017]: [emulator-5554] Installing apk... pathToApk = app/build/outputs/apk/XXX-debug-androidTest.apk
[Tue Apr 11 09:41:26 UTC 2017]: [emulator-5560] Successfully installed apk in 3 seconds, pathToApk = ./app/build/outputs/apk/XXX.apk
[Tue Apr 11 09:41:26 UTC 2017]: [emulator-5560] Installing apk... pathToApk = app/build/outputs/apk/XXX-debug-androidTest.apk
[Tue Apr 11 09:41:27 UTC 2017]: [emulator-5556] Successfully installed apk in 2 seconds, pathToApk = app/build/outputs/apk/XXX-debug-androidTest.apk
[Tue Apr 11 09:41:27 UTC 2017]: [emulator-5556] Starting tests...
[Tue Apr 11 09:41:28 UTC 2017]: [emulator-5554] Successfully installed apk in 2 seconds, pathToApk = app/build/outputs/apk/XXX-debug-androidTest.apk
[Tue Apr 11 09:41:28 UTC 2017]: [emulator-5554] Starting tests...
[Tue Apr 11 09:41:28 UTC 2017]: [emulator-5558] Successfully installed apk in 2 seconds, pathToApk = app/build/outputs/apk/XXX-debug-androidTest.apk
[Tue Apr 11 09:41:28 UTC 2017]: [emulator-5558] Starting tests...
[Tue Apr 11 09:41:29 UTC 2017]: [emulator-5560] Successfully installed apk in 2 seconds, pathToApk = app/build/outputs/apk/XXX-debug-androidTest.apk
[Tue Apr 11 09:41:29 UTC 2017]: [emulator-5560] Starting tests...
[Tue Apr 11 09:41:29 UTC 2017]: [emulator-5562] Successfully installed apk in 6 seconds, pathToApk = ./app/build/outputs/apk/XXX.apk
[Tue Apr 11 09:41:29 UTC 2017]: [emulator-5562] Installing apk... pathToApk = app/build/outputs/apk/XXX-debug-androidTest.apk
[Tue Apr 11 09:41:32 UTC 2017]: [emulator-5564] Successfully installed apk in 9 seconds, pathToApk = ./app/build/outputs/apk/XXX.apk
[Tue Apr 11 09:41:32 UTC 2017]: [emulator-5564] Installing apk... pathToApk = app/build/outputs/apk/XXX-debug-androidTest.apk
[Tue Apr 11 09:41:33 UTC 2017]: [emulator-5562] Successfully installed apk in 4 seconds, pathToApk = app/build/outputs/apk/XXX-debug-androidTest.apk
[Tue Apr 11 09:41:33 UTC 2017]: [emulator-5562] Starting tests...
[Tue Apr 11 09:41:35 UTC 2017]: [emulator-5564] Successfully installed apk in 3 seconds, pathToApk = app/build/outputs/apk/XXX-debug-androidTest.apk
[Tue Apr 11 09:41:35 UTC 2017]: [emulator-5564] Starting tests...
[Tue Apr 11 09:41:41 UTC 2017]: [emulator-5556] Test passed in 8 seconds: .tests.menu.about.AboutUITest.testAboutVersionName
[Tue Apr 11 09:41:41 UTC 2017]: [emulator-5558] Test passed in 7 seconds: .tests.menu.account.AccountUINegativeTest.testDriverCarPlateIsNotDisplayed
[Tue Apr 11 09:41:42 UTC 2017]: [emulator-5554] Test passed in 8 seconds: .tests.menu.account.AccountUIPositiveTest.testDriverProfilePictureIsDisplayed
[Tue Apr 11 09:41:43 UTC 2017]: [emulator-5560] Test passed in 8 seconds: .tests.menu.MenuHeaderPositiveTest.testDriverRating
[Tue Apr 11 09:41:44 UTC 2017]: [emulator-5562] Error during tests run: java.lang.IllegalStateException: Unexpected Start code in second entry, please report that to Composer maintainers (InstrumentationEntry(numTests=11, stream=.tests.menu.MenuHeaderPositiveTest:, id=AndroidJUnitRunner, test=testDriverPicture, clazz=.tests.menu.MenuHeaderPositiveTest, current=1, stack=, statusCode=Start, timestampNanos=95440347915313), InstrumentationEntry(numTests=11, stream=.tests.menu.MenuHeaderPositiveTest:, id=AndroidJUnitRunner, test=testDriverPicture, clazz=.tests.menu.MenuHeaderPositiveTest, current=1, stack=, statusCode=Start, timestampNanos=95447432113000))
Exception in thread "main" java.lang.IllegalStateException: Unexpected Start code in second entry, please report that to Composer maintainers (InstrumentationEntry(numTests=11, stream=.tests.menu.MenuHeaderPositiveTest:, id=AndroidJUnitRunner, test=testDriverPicture, clazz=.tests.menu.MenuHeaderPositiveTest, current=1, stack=, statusCode=Start, timestampNanos=95440347915313), InstrumentationEntry(numTests=11, stream=.tests.menu.MenuHeaderPositiveTest:, id=AndroidJUnitRunner, test=testDriverPicture, clazz=.tests.menu.MenuHeaderPositiveTest, current=1, stack=, statusCode=Start, timestampNanos=95447432113000))
	at com.gojuno.composer.InstrumentationKt$asTests$1.call(Instrumentation.kt:119)
	at com.gojuno.composer.InstrumentationKt$asTests$1.call(Instrumentation.kt)
	at rx.internal.operators.OperatorScan$3.onNext(OperatorScan.java:138)
	at rx.internal.operators.OperatorMerge$MergeSubscriber.emitScalar(OperatorMerge.java:395)
	at rx.internal.operators.OperatorMerge$MergeSubscriber.tryEmit(OperatorMerge.java:355)
	at rx.internal.operators.OperatorMerge$InnerSubscriber.onNext(OperatorMerge.java:846)
	at rx.internal.operators.OnSubscribeMap$MapSubscriber.onNext(OnSubscribeMap.java:77)
	at rx.internal.operators.OnSubscribeFilter$FilterSubscriber.onNext(OnSubscribeFilter.java:76)
	at rx.internal.operators.OperatorScan$InitialProducer.emitLoop(OperatorScan.java:323)
	at rx.internal.operators.OperatorScan$InitialProducer.emit(OperatorScan.java:295)
	at rx.internal.operators.OperatorScan$InitialProducer.onNext(OperatorScan.java:202)
	at rx.internal.operators.OperatorScan$3.onNext(OperatorScan.java:144)
	at rx.internal.operators.OperatorTakeWhile$2.onNext(OperatorTakeWhile.java:67)
	at rx.internal.operators.OnSubscribeCreate$BufferEmitter.drain(OnSubscribeCreate.java:366)
	at rx.internal.operators.OnSubscribeCreate$BufferEmitter.onNext(OnSubscribeCreate.java:299)
	at com.gojuno.composer.FilesKt$tail$1$1.handle(Files.kt:15)
	at org.apache.commons.io.input.Tailer.readLines(Tailer.java:528)
	at org.apache.commons.io.input.Tailer.run(Tailer.java:470)
	at java.lang.Thread.run(Thread.java:745)
Caused by: rx.exceptions.OnErrorThrowable$OnNextValue: OnError while emitting onNext value: com.gojuno.composer.InstrumentationEntry.class
	at rx.exceptions.OnErrorThrowable.addValueAsLastCause(OnErrorThrowable.java:118)
	at rx.exceptions.Exceptions.throwOrReport(Exceptions.java:190)
	at rx.internal.operators.OperatorScan$3.onNext(OperatorScan.java:140)
	... 16 more

Enhance Suite page.

  • Reduce paddings (t,b) for test item.
  • Enlarge test item duration text.
  • Create color mapping for each test device and apply color to device name label.
  • Set Suite $id as Page Title.

Dynamic test sharding.

Currently Composer supports only static sharding which is a feature of Android Test Support library.

Static sharding tend to be inefficient since it is impossible to know statically duration of each individual test execution, which means that some devices may run out of tests to execute faster than others which creates bottleneck for the overall test run time.

Composer can communicate with test runner on a device and run tests in interactive mode when Composer gives commands to test runner on a device to run particular test which should decrease overall test run time and increase resource usage efficiency.

Display attached .log files on the test page

ATM we display all the logs from the device and it's too verbose. It would be great to display .log file per test case that will be the result of all the necessary logs written in a separate file.

Gradle plugin

Any plans for a gradle plugin or would you be interested in discussing dsl design for one?

Add test id to json.

Currently web part has to combine id itself and it's not very convenient, i.e. "id": "$package_name$class_name$name".

Enhance Test Page.

  • Increase font size on test name.
  • Add line with green/red color.
  • Remove "label" from device name.
  • Redesign test duration.
  • Print test name as page title.

WIP: HTML Report

Sketch

sketch

Next step: collect links to good examples of coloring, fonts and overall web page styles.
Next step: discuss that with our Web Frontend Team.

ADB install timeout

I am using Spoon to run instrumentation tests and I am trying to migrate to Composer.

Sometimes Composer fails with TimeoutException (log: https://gist.github.com/lukaville/41d105ca9082b8168f58c034f56a6542). It always fails at 24% (I tried to change timeout in installApk extension function and it didn't help, it fails at 24% too).

After this exception I can't connect to emulator via adb (even from other machine). It says that "device offline", but emulator is running and I can use it through UI.

In README.md mentioned that adb install timeout problems occurs when using Spoon, but I have absolutely opposite result: with patched composer that uses ddmlib to install apks, timeout exceptions vanished.

Anyone have any guesses about cause of the problem? Thanks.

Sometimes *.output files are not deleted automatically.

Can't figure out the trigger yet, but sometimes *.output is not deleted.
Got a bunch of files, it contained

Script started on Tue Apr 11 15:01:33 2017
command: /Users/dmitryyunitsky/Library/Android/sdk/platform-tools/adb devices
Script started on Tue Apr 11 15:01:33 2017
command: /Users/dmitryyunitsky/Library/Android/sdk/platform-tools/adb devices
List of devices attached
Script started on Tue Apr 11 15:01:33 2017
command: /Users/dmitryyunitsky/Library/Android/sdk/platform-tools/adb devices
Script started on Tue Apr 11 15:01:33 2017
command: /Users/dmitryyunitsky/Library/Android/sdk/platform-tools/adb devices
List of devices attached
Script started on Tue Apr 11 15:01:33 2017
command: /Users/dmitryyunitsky/Library/Android/sdk/platform-tools/adb devices
List of devices attached
emulator-5554 device
Script done on Tue Apr 11 15:01:33 2017
Script started on Tue Apr 11 15:01:33 2017
command: /Users/dmitryyunitsky/Library/Android/sdk/platform-tools/adb devices

Logcat formatting in HTML report.

@artem-zinnatullin Currently I have created 4 CSS classes, check if smth is missing, screenshot is attached (if you don't like the colors I've used, just give me a screenshot with console of your taste and I will apply its colors).

.log__info {
  color: $green;
}

.log__debug {
  color: $electric;
}

.log__error {
  color: $red;
}

.log__warn {
  color: $yellow;
}

Also, there can be a problem with spaces — no matter how many spaces you add one by one, in browser thay will be trimmed into one. It can be fixed with using   symbol but that can also be a problem as leads ti nowrap line.

screenshot 2017-05-30 19 18 10

Add integration tests for Composer.

Currently we only have some amount of unit tests, will be great to actually run some integration tests agains Android emulator (even though they're not stable on Travis CI).

Make sure Composer marks test run as failed if test runner throws error before actual test run.

AndroidJUnitRunner from test support library v1.0 fails test run if app or test apk references non-existing classes. See https://issuetracker.google.com/u/1/issues/64094195

Runner v0.5 printed that as instrumentation problem but continued to run tests (that was not perfect, but better behavior), Runner v1.0 fails test run.

Firebase Test Cloud happily marks test run as successful in both cases even though in fact in second case none of the tests did actually run.

That's why I'm creating this issue against Composer to make sure (add test) that following instrumentation output will cause error in Composer and test run won't be marked as successful.

INSTRUMENTATION_RESULT: stream=

Time: 0
There was 1 failure:
1) Fatal exception when running tests
java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/annotation/processing/AbstractProcessor;
    at java.lang.Class.classForName(Native Method)
    at java.lang.Class.forName(Class.java:400)
    at android.support.test.internal.runner.TestLoader.doCreateRunner(TestLoader.java:76)
    at android.support.test.internal.runner.TestLoader.getRunnersFor(TestLoader.java:104)
    at android.support.test.internal.runner.TestRequestBuilder.build(TestRequestBuilder.java:808)
    at android.support.test.runner.AndroidJUnitRunner.buildRequest(AndroidJUnitRunner.java:481)
    at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:367)
    at com.app.test.InstrumentationRunner.onStart(InstrumentationRunner.java:26)
    at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1962)
Caused by: java.lang.ClassNotFoundException: Didn't find class "javax.annotation.processing.AbstractProcessor" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/data/app/com.app.test-1/base.apk", zip file "/data/app/com.app-1/base.apk"],nativeLibraryDirectories=[/data/app/com.app.test-1/lib/arm64, /data/app/com.app-1/lib/arm, /system/fake-libs, /data/app/com.app.test-1/base.apk!/lib/armeabi-v7a, /data/app/com.app-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    ... 9 more

FAILURES!!!
Tests run: 0,  Failures: 1


INSTRUMENTATION_CODE: -1

Composer already fails test run if 0 tests were run, but I just want make code even more robust against such stupid errors and be better than Firebase at parsing Google's crazy instrumentation output format.

Exception: runningEmulators: retrying java.lang.IllegalStateException: Process [script, -F, ..., adb, devices] exited with non-zero code 1

Hi,
I decided to give composer a shot and unfortunately, I can't make it work.

After executing:

java -jar composer-0.2.3.jar --apk app/build/outputs/apk/app.apk --test-apk app/build/outputs/apk/app-androidTest.apk --test-package package --test-runner package.MultiDexAndroidJUnitRunner

I receive following errors:

[Mon Jul 10 09:14:25 CEST 2017]: runningEmulators: retrying java.lang.IllegalStateException: Process [script, -F, /.../2920001465450.output, /usr/local/share/android-sdk/platform-tools/adb, devices] exited with non-zero code 1 .
[Mon Jul 10 09:14:25 CEST 2017]: runningEmulators: retrying java.lang.IllegalStateException: Process [script, -F, /.../2917665125786.output, /usr/local/share/android-sdk/platform-tools/adb, devices] exited with non-zero code 1 .
[Mon Jul 10 09:14:25 CEST 2017]: runningEmulators: retrying java.lang.IllegalStateException: Process [script, -F, /...2919879561453.output, /usr/local/share/android-sdk/platform-tools/adb, devices] exited with non-zero code 1 .
[Mon Jul 10 09:14:25 CEST 2017]: runningEmulators: retrying java.lang.IllegalStateException: Process [script, -F, /.../2919212779445.output, /usr/local/share/android-sdk/platform-tools/adb, devices] exited with non-zero code 1 .
[Mon Jul 10 09:14:25 CEST 2017]: Error during getting connectedAdbDevices, error = java.lang.IllegalStateException: Process [script, -F, /.../2917033128684.output, /usr/local/share/android-sdk/platform-tools/adb, devices] exited with non-zero code 1
Exception in thread "main" java.lang.IllegalStateException: Process [script, -F, /.../2917033128684.output, /usr/local/share/android-sdk/platform-tools/adb, devices] exited with non-zero code 1
at com.gojuno.commander.os.ProcessesKt$process$1.call(Processes.kt:97)
at com.gojuno.commander.os.ProcessesKt$process$1.call(Processes.kt)
at rx.internal.operators.OnSubscribeCreate.call(OnSubscribeCreate.java:72)
at rx.internal.operators.OnSubscribeCreate.call(OnSubscribeCreate.java:32)
at rx.Observable.unsafeSubscribe(Observable.java:10256)
at rx.internal.operators.OperatorSubscribeOn$SubscribeOnSubscriber.call(OperatorSubscribeOn.java:100)
at rx.internal.schedulers.CachedThreadScheduler$EventLoopWorker$1.call(CachedThreadScheduler.java:230)
at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

To make sure that adb works fine, just before running composer, I executed:

adb devices

which printed:

List of devices attached
emulator-5554 device
010a625c2eaab236 device

echo $ANDROID_HOME

/usr/local/share/android-sdk

What am I doing wrong? How to fix it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.