nenick / AndroidStudioAndRobolectric

Minimal Robolectric and Android Studio example
139 stars 29 forks source link

Support for running unit tests in parallel #2

Closed CDRussell closed 9 years ago

CDRussell commented 9 years ago

Use of android-unit-test plugin allows for configuring the number of forks to use during test execution, as does having a vanilla java module within the project to host the unit tests. This is typically achieved by configuring a 'maxParallelForks' value in the build scripts.

Such configuration has allowed my test suite to complete in ~3.5 mins. Without it, it takes over 10 mins.

A way to configure an equivalent to 'maxParallelForks' using this setup would definitely be appreciated.

nenick commented 9 years ago

Looks like they have no native support for this implemented yet. https://code.google.com/p/android/issues/detail?id=140241

CDRussell commented 9 years ago

Cool, thanks. At least it has been flagged as high priority for 1.2.

On Tue, 17 Feb 2015 11:41 Nico Küchler notifications@github.com wrote:

Looks like they have no native support for this implemented yet. https://code.google.com/p/android/issues/detail?id=140241

— Reply to this email directly or view it on GitHub https://github.com/nenick/AndroidStudioAndRobolectric/issues/2#issuecomment-74655313 .

nenick commented 9 years ago

You can try the plugin from the robolectric team, maybe with this you get all working what you need https://github.com/robolectric/robolectric-gradle-plugin

jaredsburrows commented 9 years ago

With Gradle builds:

gradlew --parallel

With Robolectric plugin:

robolectric {
    // Specify max number of processes (default is 1)
    maxParallelForks = 4

    // Specify max number of test classes to execute in a test process
    // before restarting the process (default is unlimited)
    forkEvery = 150
}
nenick commented 9 years ago

Great! Thanks for reporting.

jaredsburrows commented 9 years ago

@nenick Thanks for making this repo. Also, this is not an issue related to your repo, so I believe you can close this.

nenick commented 9 years ago

I like to know you opinion.

Current my plan is to let the issues open until they are really "fixed". Most issues have a reference to an open google issue and shows the existing workaround. Yes they are not related to this samples. I guess it is much easier to use the open issues if you try to apply this setup to an existing project instead of searching the closed issues which are still relevant.

jaredsburrows commented 9 years ago

But there is no "fix" for this, there is already support.

This is an example repository, not the Robolectric repository.

Gradle does supports parallel builds.

Robolectric does support parallel tests.

So there is no issue here.