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.
includeTestsMatching. TestFilter includeTestsMatching(String testNamePattern) Appends a test name pattern to the inclusion filter. Wildcard '*' is supported, either test method name or class name is supported. Examples of test names: "com.
useJUnitPlatform() Specifies that JUnit Platform should be used to discover and execute the tests.
JUnit Jupiter is the combination of the programming model and extension model for writing tests and extensions in JUnit 5. The Jupiter sub-project provides a TestEngine for running Jupiter based tests on the platform. JUnit Vintage provides a TestEngine for running JUnit 3 and JUnit 4 based tests on the platform.
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.
I had the issue, try upgrading the test runner. Upgrading it to 0.5 from 0.4.x solved it. Ensure you have these lines in your build.gradle:
androidTestCompile "junit:junit:4.12" androidTestCompile "com.android.support.test:runner:0.5"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With