Make Robolectric run test for the current build type only

464 views Asked by At

I'm using Robolectric alongside Android Studio (v 1.2.2)

classpath 'com.android.tools.build:gradle:1.2.3'

buildToolsVersion "21.1.2"

testCompile 'org.robolectric:robolectric:3.0-rc3'

My project contains 4 build types. In spite of having debug build type selected in the "Build Variants" window, Robolectric tests every declared build type (4 times).

Is it an expected behavior? How can I narrow down execution to just debug build type?

Thanks.

1

There are 1 answers

1
Eugen Martynov On BEST ANSWER

It is quite simple. Let assume you have next:

productFlavours {
   one
   two
}

So to run tests for on flavour you simply run gradle:

gradle testOneDebug

To run all tests for all variants:

gradle test