I often find that I duplicate the exact set of test classes, such as mocks or helpers, for Android /androidTest tests and unit tests /test when writing tests for an application module.
For example, I have some static functions that help me quickly configure mocks in /test/MockUtils.java However, I cannot reuse this helper class in any of my Android tests, because they do not use the same class path - /androidTest vs /test .
I was thinking of creating a new module that contains only test resources. However, this idea will not fly, because the Android Gradle plugin refuses to depend on the application module.
projectCommon allows an APK archive that is not supported as a compilation dependency.
Is there any other way to create test classes that can be reused in Android tests and unit tests?
source share