I want to achieve something like this:
[ComponentTestsModule] com.android.test [FunctionalTestsModule] com.android.test both depends on -> [TestLibraryModule] ? which depends on -> [AppModule] com.android.application Is there any way to do it with android Gradle plugin 3.0+?
I want different test runners for different types of tests, also target different variants. It is working right now with single codebase under androidTest, but with ugly switches in the custom test runner.
I want to share the same page-objects between different types of tests, and maybe some utility code. Problem is: that page objects must have access to R class of app (locators: R.id.*)
None of the module types I'm aware of can depend on APK-producing module, expect from com.android.test, but i cannot depend from com.android.test with another com.android.test.
I have recently faced this problem and just want to share my solution in case some body needs it.
What I have done so far (not a perfect solution - I guess, but at least it works).
Create a new module named testing_base or some thing like that
In testing_base module only put things related to testing (Like the code you want it to be shared between modules) in to normal packages, NOT in the test packages/folders.
From others module, try to import things from testing_base module
ex:
testImplementation project(":testing_base")
Hope it can helps someone, happy testing!
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