Spoon Gradle Plugin


Source link: https://github.com/stanfy/spoon-gradle-plugin

Spoon Gradle Plugin

Gradle plugin for Spoon. Allows you to run spoon with almost no effort under new Android build system.

Plugin generates spoon${ TEST_VARIANT } tasks for every test variation in your application project.

Usage

buildscript {

repositories {

  mavenCentral()

}

 dependencies {

  classpath 'com.stanfy.spoon:spoon-gradle-plugin:1.2.2'

}
 
}
  apply plugin: 'spoon'  // This section is optional spoon {

// for debug output
debug = true
 // To run a single test class
className = 'fully.qualified.TestCase'
 // To run a single method in TestCase
methodName = 'testMyApp'
 // To execute the tests device by device */
sequential = true
 // To grant permissions to Android M >= devices */
grantAllPermissions = true 
}

After applying the plugin you'll find spoon${ TEST_VARIANT } tasks in your project.

You may run all the test variations with

gradle spoon 

Generated reports are available at build/spoon/${ TEST_VARIANT } folder.

For making screenshots add spoon-client dependency to your tests compile configuration:

dependencies {

androidTestCompile 'com.squareup.spoon:spoon-client:1.6.4' 
}

By default the plugin runs tests on all the connected devices. In order to run them on some concrete devices instead, you may specify their serial numbers:

spoon {

devices = ['333236E9AE5800EC']
skipDevices = ['serial-you-want-to-skip'] 
}

It is also allowed to specify specify size of tests that should be run. You may run all the tests annotated as @SmallTest with the following line:

gradle spoonSmall

Run gradle tasks for details about size rules.

You may also setup your project to take parameters for class/method to be run from command line. E.g.:

gradle spoon -PspoonClassName=fully.qualified.TestCase

And project configuration:

spoon {

if (project.hasProperty('spoonClassName')) {

  className = project.spoonClassName
  
}
 
}

Test Sharding

You can configure test sharding using the numShards and shardIndex properties ( documentation):

spoon {

numShards = 4
shardIndex = 0 
}

If you are specifying sharding for multiple devices, you may use spoon's built in auto-sharding by specifying:

spoon {

shard = true 
}

This will automatically shard across all specified serials, and merge the results.

Custom instrumentation arguments

Use the instrumentationArgs property on spoon extension to pass custom parameters to your tests:

spoon {

instrumentationArgs = ["foo=bar", "name=value"] 
}

Code Coverage

You can configure spoon to calculate code coverage by using codeCoverage property on spoon extension:

spoon {

codeCoverage = true 
}

This option requires your app to have the WRITE_EXTERNAL_STORAGE permission.

Known issues

If you have troubles with running Android Lint after this plugin is applied, try the following workaround

buildscript {

// ...
dependencies {

  classpath('com.stanfy.spoon:spoon-gradle-plugin:1.2.2') {

 exclude module: 'guava'
  
}

  classpath 'com.google.guava:guava:17.0'

}
 
}

You can find details in the related issue.

Testing

After making editions, run

./gradlew integrationTest 

This will install the plugin to local maven repo and run spoon task in the example project.

License

Copyright 2013-2016 Stanfy Corp.  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
  http://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. 

Resources

Chameleon is a CSS like framework for Android. Chameleon can read styles in JSON format and apply them on views in Android. Not only can you choose from the variety of styles provided by the library but also add your own styles by changing just one file.

The icing on the cake is, once set up, themes can be updated without pushing a new version of your app to the playstore. So, your users can see your changes on the fly.

An android wrapper for openweathermap that uses Retrofit 2 under the hood.

You need an API Key to use the OpenWeatherMap API. Head on over to their website if you don't already have one.

Features

Get Current weather by:

  1. City Name
  2. City ID
  3. Geographic Coordinates
  4. Zip Code

Custom views of NestedScrollingChild class.

Logging value of object in a short and pretty way.

  • Don't need to define TAG, It is automatically generated by FileName - ClassName - Method - [Message] Object (Value)
  • Log all field and value of given object

This is small library with few annotations and processors that will generate all RecyclerView.Adapters stuff that you need with only few lines of annotations.

Advanced Sms Manager is library for sending sms for single and two sim-card phones. it is very handy and usefull.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes