marathon icon indicating copy to clipboard operation
marathon copied to clipboard

Test bundle not reporting test annotations

Open DavidDTA opened this issue 8 months ago • 11 comments

I am running into an issue where the remote test parser is not correctly identifying test annotations. I have been following the instructions here, and I think I've done it correctly:

  • I have included androidTestImplementation("com.malinskiy.adam:android-junit4-test-annotation-producer:0.5.7") in my build.gradle.kts
  • I have included
    vendorConfiguration:
      testParserConfiguration:
        type: "remote"
        instrumentationArgs:
          listener: "com.malinskiy.adam.junit4.android.listener.TestAnnotationProducer"
    
    in my Marathonfile.
  • Running adb shell am instrument -w -r -e log true -e listener com.malinskiy.adam.junit4.android.listener.TestAnnotationProducer <mypackage>/<mytestrunner> produces a lot of output of the form
INSTRUMENTATION_STATUS_CODE: 0
INSTRUMENTATION_STATUS: class=<mytestclass>
INSTRUMENTATION_STATUS: current=114
INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
INSTRUMENTATION_STATUS: numtests=117
INSTRUMENTATION_STATUS: stream=
INSTRUMENTATION_STATUS: test=<mytestname>
INSTRUMENTATION_STATUS_CODE: 1
INSTRUMENTATION_STATUS: com.malinskiy.adam.junit4.android.listener.TestAnnotationProducer.v4=[64Lorg.junit.Test(34Lexpected=class org.junit.Test$None9Ltimeout=0), 199Lkotlin.Metadata(26LbytecodeVersion=[I@c09340e33Ldata1=[Ljava.lang.String;@e9b9e2f33Ldata2=[Ljava.lang.String;@9cedc3c11LextraInt=4812LextraString=6Lkind=126LmetadataVersion=[I@6963dc512LpackageName=), 45Ldagger.hilt.android.testing.HiltAndroidTest()]
INSTRUMENTATION_STATUS_CODE: 2
INSTRUMENTATION_STATUS: class=<mytestclass>
INSTRUMENTATION_STATUS: current=114
INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
INSTRUMENTATION_STATUS: numtests=117
INSTRUMENTATION_STATUS: stream=.
INSTRUMENTATION_STATUS: test=<mytestname>
  • Running the tests via ./gradlew marathon does allow me to filter tests by test annotation.

However, when running via the command line, I see the following in the output:

Bundle //app/build/outputs/apk/androidTest/play/debug/app-play-debug-androidTest.apk did not report any test annotations. If you need test annotations retrieval, remote test parser requires additional setup see https://docs.marathonlabs.io/runner/android/configure#test-parser

I also noticed that the output does report when it is running the am instrument command to actually run the tests, but it does not ever claim to run the am instrument -e log true command (I'm not sure whether it would when things are working properly).

DavidDTA avatar Jun 21 '24 16:06 DavidDTA