JandemX/gradle-spoon-plugin


A Gradle plugin for running Android instrumentation tests with Spoon.

Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.JandemX:gradle-spoon-plugin:2.7.3'
	}
	dependencies {
		implementation("com.github.JandemX:gradle-spoon-plugin:2.7.3")
	}
	<dependency>
	    <groupId>com.github.JandemX</groupId>
	    <artifactId>gradle-spoon-plugin</artifactId>
	    <version>2.7.3</version>
	</dependency>

                            
    libraryDependencies += "com.github.JandemX" % "gradle-spoon-plugin" % "2.7.3"
        
        

                            
    :dependencies [[com.github.JandemX/gradle-spoon-plugin "2.7.3"]]
        
        

Readme


gradle-spoon-plugin Build Status Maven Central

A Gradle plugin for running Android instrumentation tests with Spoon.

Basic usage

Add to your build.gradle

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'de.felixschulze.gradle:gradle-spoon-plugin:2.7.3'
    }
}

apply plugin: 'de.felixschulze.gradle.spoon'

Advanced usage

Add to your build.gradle

spoon {
    teamCityLog = true
    debug = true
    noAnimations = true
    failOnFailure = false
    testSizes = ['small', 'medium']
    adbTimeout = 10*60
    failIfNoDeviceConnected = false
    excludedDevices = ['f5adb1a1', 'a6asb224']
}
  • teamCityLog: Add features for TeamCity
  • debug: Activate debug output for spoon
  • noAnimations: Deactivate gif generation
  • failOnFailure: Deactivate exit code on failure
  • testSizes: Only run test methods annotated by testSize (small, medium, large)
  • adbTimeout: ADB timeout in seconds
  • failIfNoDeviceConnected: Fail if no device is connected
  • excludedDevices: List of devices which should be excluded
  • instrumentationArgs: List of arguments to pass to the Instrumentation Runner

Running specific test classes or test methods

-PspoonTestClass=fully_qualified_test_class_package_name
-PspoonTestMethod=testMethodName

Workaround for gradle-android-plugin 1.5.0 Multidex bug

// Workaround for Multidex bug in gradle-android-plugin
// Replace Multidex dependency with some dummy dependency to avoid dex problems
// @see https://code.google.com/p/android/issues/detail?id=194609
project.getConfigurations().all { config ->
    if (config.name.contains("AndroidTest")) {
        config.resolutionStrategy.eachDependency { DependencyResolveDetails details ->
            if (details.requested.name == "multidex") {
                details.useTarget("de.felixschulze.teamcity:teamcity-status-message-helper:1.2")
            }
        }
    }
}

Changelog

Releases

License

gradle-spoon-plugin is available under the MIT license. See the LICENSE file for more info.