10

I have been working on project in Android Studio Bumblebee, and the project contains several packages , some of them have test classes using Junit and Mockito.
So inorder to increase code coverage, I had excluded the packages with zero unit tests in Debug configurations . But after updating to Android Studio Chipmunk, after I exclude any package or any class file and run again, none of the test cases are run and shows this message

Test events were not received

I also tried adding the classes that I need coverage, still the same issue.

subin
  • 101
  • 1
  • 5
  • is that the only message? if you have more log messages please share them as well – elbraulio May 23 '22 at 03:33
  • I have the same issue, in the build tag only the following is received: Task execution finished ' testDebugUnitTest --tests "com.mypackage*" --stacktrace'. – htafoya May 24 '22 at 04:56
  • I have the same problem when I modify `run configurations`( to add tracing for example), I need to run from the terminal to run the test – padPad May 24 '22 at 09:00
  • 1
    Apparently there is a bug in IntelliJ IDEA 2021.2 which AS Chipmunk is based on. Currently the only "proper" workaround is to downgrade to Bumblebee until its resolved. So far the issue seems to persist even in the Beta 1 of Dolphin. Alternatively you can import your "main" sources into your "test" sources, but IMHO this isn't even a workaround, its just plain bad and still would break any kind of CI/CD you might have. – Chapz May 24 '22 at 15:20
  • I agree with you @Chapz, downgrading android studio to bumblebee solved the issue – subin May 27 '22 at 12:31
  • I think I am going to lose my job of this fiasco. Our 500+ test doesn't run anymore and this will impact our script in our CI/CD pipeline and we are blocked by this because we can't send anything to the QA. Tests are borked after upgrading to Android build gradle tool 7.2.2. What a f*(*(as fiasco – Neon Warge Aug 24 '22 at 06:55

5 Answers5

3

As a workaround you may run the tests through the gradle task window:

Use the command that you used for your run configurations:

gradle testDebugUnitTest --tests "your.package*"

enter image description here

htafoya
  • 18,261
  • 11
  • 80
  • 104
0

Add in your module build.gradle testImplementation project(":name-of-your-module").

It's a workaround!

pedrofsn
  • 326
  • 2
  • 15
  • 1
    This is not a good workaround, as it would break CI/CD pipelines. The issue is in the IntelliJ IDEA version that AS Chipmunk is based on, and there isn't a fix yet. – Chapz May 24 '22 at 15:21
0

I was having the same problem. As of today I updated to last AS - Chipmunk Patch2, AGP to 7.2.2 and Gradle to 7.3.3, the problem was fixed, without any other change r workarounds. Seems that the bug has been fixed.

MRodrigues
  • 1,927
  • 1
  • 17
  • 22
0

Works in Dolphin just fine. To reproduce success perform the following:

  1. In Run/Debug Configurations add in a new "Gradle Configuration" using the plus button.
  2. Give it a name in the name text box ("All Unit Tests" for example)
  3. In the run text box add the following testDebugUnitTest --tests "com.example.*" Where com.example is your namespace common across all modules, leave the .* at the end, this is the secret sauce.
  4. In the Gradle project box ensure that the root gradle build file is selected.
  5. Click apply/ok then select the config and run.

It should all work just fine now...or maybe not depending on any tests failing ;)

0

if you use Kotlin, check your "build.gradle" file and add apply "kotlin-android" plugin.

Hoyo Shaw
  • 16
  • 1