tmtrademark
tmtrademark

Reputation: 974

Unit test configuration for multiple modules

In Android Studio, it's pretty easy to create a configuration which runs the unit tests for a particular module. But is there a way to create a configuration which runs the unit tests for all modules?

My particular project has multiple modules (a "main" module and a "library" module, say). I currently have two configurations: Main Unit Tests and Library Unit Tests. This works, but it'd be nice to just have Unit Tests run all my tests.

From the command line, this is trivial - just run ./gradlew testDebug and everything's happy. But I can't seem to figure it out from Android Studio. What am I missing here?

Edit: cricket-007 points out that the gradle command bar in Android Studio can let you run the testDebug command. This works, but isn't as full featured as a true configuration. So really, the question is how to create a configuration Unit Tests that runs all of the unit tests from all modules.

Upvotes: 22

Views: 3968

Answers (1)

DanielDiSu
DanielDiSu

Reputation: 1159

I've been able to make it work choosing "All in package" and search for tests across module dependencies. Because my App module dependes from all other modules, all the tests are run when running this Task.

Configuration that worked for me

Upvotes: 11

Related Questions