This project provides an Android-backend to cucumber-jvm and is basically an updated and improved version of ccady-ubermind's cucumber-android.
Read the README
from cucumber-android/
to either
- use cucumber-android as an Android library-project or
- build a cucumber-android .jar to include elsewhere.
You can also download cucumber-android.jar here.
For an example, please look at cucumber-example-test/
.
You can use cucumber-android as an Android library-project or use a pre-built .jar.
- Create a new empty Android test-project.
- Change the instrumentation in
AndroidManifest.xml
fromInstrumentationTestRunner
toCucumberInstrumentation
:
<instrumentation
android:name="cucumber.api.android.CucumberInstrumentation"
android:targetPackage="package.of.your.own.application"/>
- Include cucumber-android and cucumber-java.
- Create a new test-configuration that uses the
CucumberInstrumentation
instrumentation runner.
- Put all your
.feature
files inside the subdirectoryassets/features/
of the test-project. - For your step-defintions, you must use an
InstrumentationTest
(e.g.ActivityInstrumentationTestCase2
). - You can have multiple test-classes for your step-definitions, refer to
cucumber-example-test/
for an example. - Start the test-project and the
CucumberInstrumentation
will run all your features.
You can use @RunWithCucumber to pass parameters to Cucumber.