• Stars
    star
    123
  • Rank 290,145 (Top 6 %)
  • Language
    Groovy
  • License
    Apache License 2.0
  • Created about 7 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Gradle plugin that provides a task to run Android instrumentation tests via Spoon.

Gradle Spoon Plugin

License Maven Build Twitter Follow

Gradle plugin for Spoon 2+ and Android Gradle Plugin 3+.

Download

Release:

buildscript {
  repositories {
    mavenCentral()
    // For Spoon snapshot, until 2.0.0 is released
    maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
  }

  dependencies {
    classpath 'com.jaredsburrows:gradle-spoon-plugin:1.6.0'
  }
}

repositories {
  // For Spoon snapshot, until 2.0.0 is released
  maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}

apply plugin: 'com.android.application'
apply plugin: 'com.jaredsburrows.spoon'

dependencies {
  // For Spoon snapshot, until 2.0.0 is released
  androidTestCompile 'com.squareup.spoon:spoon-client:2.0.0-SNAPSHOT'
}

Release versions are available in the Sonatype's release repository.

Snapshot:

buildscript {
  repositories {
    maven { url 'https://oss.jfrog.org/artifactory/oss-snapshot-local/' }
    // For Spoon snapshot, until 2.0.0 is released
    maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
  }

  dependencies {
    classpath 'com.jaredsburrows:gradle-spoon-plugin:1.6.1-SNAPSHOT'
  }
}

repositories {
  // For Spoon snapshot, until 2.0.0 is released
  maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}

apply plugin: 'com.android.application'
apply plugin: 'com.jaredsburrows.spoon'

dependencies {
  // For Spoon snapshot, until 2.0.0 is released
  androidTestCompile 'com.squareup.spoon:spoon-client:2.0.0-SNAPSHOT'
}

Snapshot versions are available in the Sonatype's snapshots repository.

Library modules:

This plugin allows Spoon to be run on library modules too!

apply plugin: 'com.android.library'
apply plugin: 'com.jaredsburrows.spoon'

dependencies {
  // For Spoon snapshot, until 2.0.0 is released
  androidTestCompile 'com.squareup.spoon:spoon-client:2.0.0-SNAPSHOT'
}

Tasks

Entire project:

  • gradlew spoon{variant}

or per module:

  • gradlew app:spoon{variant}
  • gradlew library:spoon{variant}

Usage

Optional extension:

spoon {
  // Identifying title for this execution. ("Spoon Execution" by default)
  title = "My tests"
  
  // Path to output directory. ("$buildDir/spoon-output" by default)
  baseOutputDir = "spoonTests"

  // Whether or not debug logging is enabled. (false by default)
  debug = true

  // Whether or not animations are enabled. Disable animated gif generation. (false by default)
  noAnimations = true

  // Set ADB timeout. (minutes) (default is 10 mins)
  adbTimeout = 5

  // Add device serials for test execution
  devices = ["emulator-5554", "emulator-5556"]

  // Add device serials for skipping test execution.
  skipDevices = ["emulator-5555"]

  // Extra arguments to pass to instrumentation.
  instrumentationArgs = ["listener:com.foo.Listener,com.foo.Listener2", "classLoader:com.foo.CustomClassLoader"]

  // Test class name to run (fully-qualified).
  className = "com.android.foo.FooClassName"
  
  // Run annotated tests - small, medium, large
  testSize = "large"
  
  // Allow no devices to be connected. (false by default)
  allowNoDevices = true

  // Execute the tests device by device. (false by default)
  sequential = true

  // Grant all runtime permissions during installation on Marshmallow and above devices. (false by default)
  grantAll = true

  // Test method name to run (must also use className)
  methodName = "testMethodName"

  // Code coverage flag. For Spoon to calculate coverage file your app must have the `WRITE_EXTERNAL_STORAGE` permission. (false by default)
  codeCoverage = true

  // Toggle sharding. (false by default)
  shard = true

  // The number of separate shards to create.
  numShards = 10

  // The shardIndex option to specify which shard to run.
  shardIndex = 2
  
  // Run tests in separate instrumentation calls.
  singleInstrumentationCall = true

  // Do not fail build if a test fails, let all the tests run and finish. (false by default)
  ignoreFailures = true

  // Clear app data before each test. (false by default)
  clearAppDataBeforeEachTest = true
}

License

Copyright (C) 2017 Jared Burrows

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

More Repositories

1

android-gradle-java-app-template

Gradle + Android Studio + Robolectric + Espresso + Mockito + EasyMock/PowerMock + JaCoCo
Java
589
star
2

android-gif-search

Gif LazyVerticalGrid MVVM using Dagger 2 + Hilt with Retrofit 2, Moshi, Kotlin Coroutines, JUnit, Espresso and Robolectric tests!
Kotlin
393
star
3

gradle-license-plugin

Gradle plugin that provides a task to generate a HTML license report of your project.
Groovy
345
star
4

open-quartz

Google Glass Development - GDK + SDK
Java
211
star
5

rarcrack

Rarcrack - port for Mac OSX (works on Linux and Mac OSX)
C
181
star
6

android-bloatware

Keeping tracking of Bloatware that is safe to disable.
Shell
89
star
7

android-gradle-kotlin-app-template

Gradle + Android Studio + Robolectric + Espresso + JaCoCo
Kotlin
81
star
8

cs-interview-questions

Personal Solutions to Interview Questions
Java
62
star
9

android-gradle-groovy-app-template

Gradle + Android Studio + Robolectric + Espresso + RoboSpock + JaCoCo
Groovy
40
star
10

assembly-example

Common Functions and Code written in Assembly Language
Assembly
32
star
11

retrofit2-synchronous-adapter

This adapter allows synchronous return types for Retrofit 2.
Java
30
star
12

android-gradle-java-multi-module-template

Static analysis tools: PMD, Findbugs, Checkstyle, Lint and Jacoco on multi module build with an Android app module, Android library module and a Java module
Java
30
star
13

android-gradle-java-library-template

Android Gradle Library Template
Java
23
star
14

android-bazel-java-app-template

Gradle + Android Studio + Robolectric + Espresso + Mockito + EasyMock/PowerMock + JaCoCo
Java
17
star
15

open-virus

Open Source Virus Development
Shell
14
star
16

gradle-checker-framework-plugin

Gradle plugin to use the Checker Framework for Java.
Groovy
9
star
17

ios-gradle-objc-app-template

Gradle + Xcode + XCtest
Objective-C
5
star
18

ios-gradle-swift-app-template

Gradle + Xcode + XCtest
Swift
5
star
19

xml-rpcpp

XmlRpc++ - port for Mac OSX (works on Linux, Mac OSX and Windows) - http://sourceforge.net/projects/xmlrpcpp/
C++
4
star
20

flutter-app-template

Flutter App Template
Dart
3
star
21

jaredsburrows.com

Personal website
HTML
3
star
22

burrowsapps.com

Burrows Applications website
HTML
3
star
23

msp-430

Here are some examples of how to use the MSP430
C
3
star
24

gradle-ios-plugin

Gradle plugin for iOS mobile development
Groovy
3
star
25

gradle-versions-downloader

Download previous of Gradle for cache
Shell
2
star
26

bluetooth-controller

Android Bluetooth with Arduino
Java
2
star
27

hello-world

Hello world in multiple languages.
Assembly
2
star
28

android-gradle-publish-example

TBD
Kotlin
2
star
29

cplusplus-cmake-template

CMake + Boost + Protobuf + GTest + GMock
C++
2
star
30

finance-api

Finance API
Java
1
star
31

dot-files

Development Dot Files
Vim Script
1
star
32

flutter-gif-search

Flutter Gif Search
Dart
1
star
33

flutter-app-firebase

Dart
1
star
34

ci-droid

Java
1
star
35

android-login-example

Basic Android login to PHP + MySQL server, written a while ago for a demo
Java
1
star
36

flutter-app-playground

A playground for Flutter.
Dart
1
star