Skip to content
This repository was archived by the owner on Sep 2, 2020. It is now read-only.
This repository was archived by the owner on Sep 2, 2020. It is now read-only.

Exit code not propagated when instrumentation test fails #46

@urjitbhatia

Description

@urjitbhatia

Running an instrumentation test still returns 0 exit code when the test fails. Am I missing something here?

fb-adb shell am instrument -w -r   -e package com.xxxxxx.android.espresso.notification -e debug false com.xxxxxx.android.test/android.support.test.runner.AndroidJUnitRunner

<Truncated output>

Caused by: junit.framework.AssertionFailedError: Unable to send a test notification
    at junit.framework.Assert.fail(Assert.java:50)
    at com.xxxxxx.android.espresso.notification.PushNotificationTest$2.call(PushNotificationTest.java:84)
    at com.xxxxxx.android.espresso.notification.PushNotificationTest$2.call(PushNotificationTest.java:80)
    at rx.internal.util.ActionSubscriber.onError(ActionSubscriber.java:44)
    at rx.observers.SafeSubscriber._onError(SafeSubscriber.java:157)
    at rx.observers.SafeSubscriber.onError(SafeSubscriber.java:120)
    at rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber.checkTerminated(OperatorObserveOn.java:264)
    at rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber.call(OperatorObserveOn.java:207)
    at rx.android.schedulers.LooperScheduler$ScheduledAction.run(LooperScheduler.java:107)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5417)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

INSTRUMENTATION_STATUS: current=1
INSTRUMENTATION_STATUS_CODE: -2
INSTRUMENTATION_RESULT: shortMsg=junit.framework.AssertionFailedError
INSTRUMENTATION_RESULT: longMsg=junit.framework.AssertionFailedError: Unable to send a test notification
INSTRUMENTATION_CODE: 0

$ echo $?
0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions