Run a single unit test for a project from gradle without loading other project dependencies

(iam) #1

Is it possible to run a single JUnit test within the context of my project alone so that it doesn’t load the external project dependencies. My project basically has some external project dependencies (like the facebook sdk etc). When I run my tests, it checks for these dependencies and that slows it down a bit.

I’ve posted a detailed question over at stackoverflow but the more I think about this, it seems like a gradle specific query, which is why I’m posting a link here.

(I’m not aware of the etiquette and if it’s ok to repost the exact same question here. I’m just posting a link right now).


(Peter Niederwieser) #2

Gradle will only resolve the dependencies required by the tasks that are actually executed. For testing this will only be the ‘testRuntime’ dependencies (assuming the ‘compile’ and ‘testCompile’ tasks are up-to-date). As dependency resolution is cached, it usually shouldn’t result in a noticeable delay.

(Benjamin Muschko) #3

Please also see my answer on Stackoverflow.