Search code examples
androidandroid-gradle-pluginbuild.gradleandroid-testing

Gradle: No tests found


When I am trying to run Android tests by executing:

./gradlew connectedDebugAndroidTest

The following error occurs:

com.android.builder.testing.ConnectedDevice > No tests found.[devicename] FAILED
No tests found. This usually means that your test classes are not in the form that your test runner expects (e.g. don't inherit from TestCase or lack @Test annotations).
:connectedDebugAndroidTest FAILED

FAILURE: Build failed with an exception.

I have not made any changes to build.gradle or gradle-wrapper.properties files.

The issue can't be solved by updating everything to the latest version (gradle, android plugin, build tools, etc.)

All tests were previously successful. What could cause this mystic regression? Thanks.


Solution

  • One possible reason for this error message is that you get a crash in the app early in the test Runner. In such cases the exception stack will be in logcat but not in the gradle output.