Sharing Code Between Test and AndroidTest

in #android6 years ago (edited)


Who else wanted to share some code between test

and androidTest

?

It's very common to have some collection of methods or variables used for testing, and more often than not we land in a situation where we want to share it between our JUnit tests and instrumented tests.

Not sharing the code would imply duplication, which violates the DRY principle. We don't want that.

So, there's a little trick you can do with Gradle 😃...

Read full article: https://javiermendonca.com/sharing-code-between-test-and-androidtest/