GithubHelp home page GithubHelp logo

sprmn / cucumber-android Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cucumber/cucumber-android

0.0 0.0 0.0 463 KB

Android support for Cucumber-JVM

License: MIT License

Gherkin 3.98% Java 95.38% Kotlin 0.63%

cucumber-android's Introduction

Build Status

Cucumber-Android

This project implements Android support for Cucumber-JVM. It allows running cucumber tests with Android Test Orchestrator and using sharding.

NOTE: Although minSdkVersion for 'cucumber-android' is 14 it requires Java 7 language features and minimum Android API level 19. This is done purposely to allow using cucumber in apps with lower minSdk (to avoid compile errors) but tests should be run on devices with API >= 19

Developers

Prerequisites

This is ordinary multimodule Android project

  • cucumber-android - main library
  • cukeulator - sample application with instrumented tests

Building

./gradlew assemble

Setting up the dependency

The first step is to include cucumber-android into your project, for example, as a Gradle androidTestImplementation dependency:

androidTestImplementation "io.cucumber:cucumber-android:$cucumberVersion"

Using Cucumber-Android

  1. Create a class in your test package (usually <package name from AndroidManifest>.test and add @CucumberOptions annotation to that class. This class doesn't need to have anything in it, but you can also put some codes in it if you want. The purpose of doing this is to provide cucumber options. A simple example can be found in cukeulator. Or a more complicated example here:
@CucumberOptions(glue = "com.mytest.steps", format = {"junit:/data/data/com.mytest/JUnitReport.xml", "json:/data/data/com.mytest/JSONReport.json"}, tags = { "~@wip" }, features = "features")
public class MyTests 
{
}

glue is the path to step definitions, format is the path for report outputs, tags is the tags you want cucumber-android to run or not run, features is the path to the feature files.
You can also use command line to provide these options to cucumber-android. Here is the detailed documentation on how to use command line to provide these options: Command Line Options for Cucumber Android

  1. Write your .feature files under your test project's assets/ folder. If you specify features = "features" like the example above then it's assets/features.

  2. Write your step definitions under the package name specified in glue. For example, if you specified glue = "com.mytest.steps", then create a new package under your src folder named "com.mytest.steps" and put your step definitions under it. Note that all subpackages will also be included, so you can also put in "com.mytest.steps.mycomponent".

  3. Set instrumentation runner to io.cucumber.android.runner.CucumberAndroidJUnitRunner or class that extends it

android.defaultConfig.testInstrumentationRunner "cucumber.cukeulator.test.CukeulatorAndroidJUnitRunner"

Debugging

Please read the Android documentation on debugging.

Examples

Currently there is one example in subproject cukeulator

To create a virtual device and start an Android emulator:

$ANDROID_HOME/tools/android avd

cucumber-android's People

Contributors

andreasmarkussen avatar aslakhellesoy avatar aygalinc avatar brasmusson avatar fluxtah avatar friederbluemle avatar gnuechtel avatar k76154 avatar kirill-vlasov avatar lifedemons avatar lsuski avatar mfellner avatar mkochenough avatar mpkorstanje avatar nhajratw avatar rhavran avatar sierragolf 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.