Git Product home page Git Product logo

pickle's Introduction

Pickle

Pickle is an implementation of Cucumber for Android which generates the tests classes at compile time instead of runtime.

The main advantage over cucumber-android is that you won't need to use a different instrumentation runner for your Cucumber tests, and that, being generated, you can debug and inspect the tests, which makes it easier to debug errors.

Installation

Add this to your app build.gradle dependencies.

ext.pickleVersion = '1.0.0'

buildscript {
  repositories {
    jcenter()
  }

  dependencies {
    classpath 'com.fourlastor:pickle-plugin:$pickleVersion'
  }
}

dependencies {
  androidTestImplementation 'com.fourlastor:pickle-lib:$pickleVersion'
  androidTestAnnotationProcessor 'com.fourlastor:pickle-processor:$pickleVersion'
}

Configuration

Add the following to your app build.gradle

Make sure to apply this plugin before the kotlin plugin, if using one.

apply plugin: 'com.fourlastor.pickle'

pickle {
    featuresDir = 'features' // location of features inside `androidTest/src/assets`
    packageName = 'com.example.test' // package where tests will be generated
    strictMode = false // activate/deactivate strict mode (optional, defaults to true)
}

Test will be generated and you can run them as you would run normal Android Tests ๐ŸŽ‰

Disabling strict mode will generate tests only for defined scenarios, a scenario is considered defined if all the steps and background steps for that scenario are defined. The default behavior (strict) will fail at compile time if some scenarios aren't defined.

Modules

There are 3 modules: library, plugin, and annotation processor.

Library

The library contains only an annotation class (Pickle) which is required for the other 2 modules to work. This class holds the settings passed to the plugin.

Plugin

The plugin is responsible for triggering a new build in case the assets change, and to provide the extension to configure Pickle. It registers a code generation task that will create a new class representing the current state of the assets (contains a hashcode of the files).

Annotation Processor

The annotation processor will look for the hash class generated by the plugin (PickleHash, annotated with Pickle), read the settings from the annotation and generate test classes representing the feature files.

pickle's People

Contributors

fourlastor avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.