DEV Community

Max-Xampy
Max-Xampy

Posted on • Updated on

Android JUnit5 Gradle: No tests found for given includes Error

Hi I hope you're an android developper.

I will share how to solve the common problem "No tests found for given includes ...".

The Error

It occurs after we finished to add JUnit5 dependencies to gradle, wrote and run tests.

Alt Text

Before the error

I was on Android Studio 3.6 and using gradle 3.6.4. And when I upgraded Android Studio to the latest version Arctic Fox Patch 2, my tests did not run anymore.

So I decided to upgrade the version of JUnit 5.3.2 to 5.7.2 with no success. Then I started searching.

Common Solution

The common solution I found was to update the build.gradle file like this

Alt Text

Even adding it under adroid section in build.gradle file or in the build.gradle itsef, I got the following error, when I tried to sync or rerun you test:

Alt Text

I dig more deeper on gradle, finally I've found out the solution

The solution

Just remove the common solution and add lines like on the screenshot

Alt Text

And after that, sync the project with the gradle file, and run the test.

The tests is instantiated and....

Alt Text
As we wrote a good test...

Alt Text

Conclusion

No matter what happens as an error, reading the documentation is one of the best places to start searching for a solution.

Top comments (0)