Skip to content

Commit a42992d

Browse files
committed
Added Cukeulator Android example app.
1 parent 3529375 commit a42992d

File tree

22 files changed

+642
-64
lines changed

22 files changed

+642
-64
lines changed

android/README.md

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
### Prerequisites *(taken from the [maven-android-plugin](https://code.google.com/p/maven-android-plugin) documentation)*
1+
## Developers
22

3+
### Prerequisites *(taken from the [maven-android-plugin](https://code.google.com/p/maven-android-plugin) documentation)*
34
1. JDK 1.6+ installed as required for Android development
45
2. [Android SDK](http://developer.android.com/sdk/index.html) (r17 or later, latest is best supported) installed, preferably with all platforms.
56
3. [Maven 3.0.3+](http://maven.apache.org/download.html) installed
@@ -11,12 +12,7 @@ On OS X: Note that for the path to work on the commandline and in IDE's started
1112

1213
The generated target artifacts are an [apklib](https://code.google.com/p/maven-android-plugin/wiki/ApkLib) file and a regular .jar.
1314

14-
Tests are in `../cucumber-test/`.
15-
16-
## Developers
17-
18-
When running the test app, logs can be read with:
15+
Integration-tests are in `examples/android/android-test/cucumber-test/`.
1916

20-
```
21-
adb logcat
22-
```
17+
### Debugging
18+
Please read [the Android documentation on debugging](https://developer.android.com/tools/debugging/index.html).

android/project.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
target=android-8
1+
target=android-14
22
android.library=true

examples/android/android-test/README.md

+20-8
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,35 @@
1+
## Developers
12
This maven module contains an Android project with integration tests for cucumber-android.
2-
It uses the [maven-android-plugin](https://code.google.com/p/maven-android-plugin).
33

4-
To execute the tests you need the [Android SDK](https://developer.android.com/sdk/index.html) and a running
5-
[emulator](http://developer.android.com/tools/devices/emulator.html) or an attached physcial device. Please
6-
consider `AndroidManifest.xml` for min- and target-sdk versions.
4+
### Prerequisites *(taken from the [maven-android-plugin](https://code.google.com/p/maven-android-plugin) documentation)*
5+
1. JDK 1.6+ installed as required for Android development
6+
2. [Android SDK](http://developer.android.com/sdk/index.html) (r17 or later, latest is best supported) installed, preferably with all platforms.
7+
3. [Maven 3.0.3+](http://maven.apache.org/download.html) installed
8+
4. Set environment variable `ANDROID_HOME` to the path of your installed Android SDK and add `$ANDROID_HOME/tools` as well as `$ANDROID_HOME/platform-tools` to your `$PATH`.
79

8-
**Using maven (recommended only for cucumber developers):**
10+
On Windows: use `%ANDROID_HOME%\tools` and `%ANDROID_HOME%\platform-tools` instead.
911

10-
`mvn install -pl examples/android/android-test -am -P android,android-examples`
12+
On OS X: Note that for the path to work on the commandline and in IDE's started by launchd [you have to set it](http://stackoverflow.com/questions/135688/setting-environment-variables-in-os-x/588442) in `/etc/launchd.conf` and **NOT** in .bashrc or something else.
1113

12-
**Using [adb](https://developer.android.com/tools/testing/testing_otheride.html#AMSyntax) on the commandline:**
14+
### Building
15+
**Using Maven:**
1316

1417
`mvn package -pl examples/android/android-test -am -P android,android-examples`
1518

19+
### Debugging
20+
Please read [the Android documentation on debugging](https://developer.android.com/tools/debugging/index.html).
21+
22+
**Using Maven:**
23+
24+
`mvn install -pl examples/android/android-test -am -P android,android-examples`
25+
26+
**Using [adb](https://developer.android.com/tools/testing/testing_otheride.html#AMSyntax) on the commandline:**
27+
1628
`adb install -r examples/android/android-test/target/cucumber-android-test-*.apk`
1729

1830
`adb shell am instrument -w -r cucumber.android.test/cucumber.api.android.CucumberInstrumentation`
1931

20-
**Using ant (recommended for users of cucumber):**
32+
**Using Ant:**
2133

2234
Please read ["Testing from Other IDEs"](https://developer.android.com/tools/testing/testing_otheride.html).
2335

examples/android/android-test/pom.xml

+16-26
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,22 @@
1414
<packaging>apk</packaging>
1515
<name>Examples: Android-Test</name>
1616

17-
<!--<dependencies>-->
18-
<!--<dependency>-->
19-
<!--<groupId>com.google.android</groupId>-->
20-
<!--<artifactId>android</artifactId>-->
21-
<!--<scope>provided</scope>-->
22-
<!--</dependency>-->
23-
<!--<dependency>-->
24-
<!--<groupId>com.google.android</groupId>-->
25-
<!--<artifactId>android-test</artifactId>-->
26-
<!--<scope>provided</scope>-->
27-
<!--</dependency>-->
28-
<!--<dependency>-->
29-
<!--<groupId>info.cukes</groupId>-->
30-
<!--<artifactId>cucumber-android</artifactId>-->
31-
<!--<version>${project.version}</version>-->
32-
<!--<type>apklib</type>-->
33-
<!--</dependency>-->
34-
<!--<dependency>-->
35-
<!--<groupId>info.cukes</groupId>-->
36-
<!--<artifactId>cucumber-core</artifactId>-->
37-
<!--</dependency>-->
38-
<!--<dependency>-->
39-
<!--<groupId>info.cukes</groupId>-->
40-
<!--<artifactId>cucumber-java</artifactId>-->
41-
<!--</dependency>-->
42-
<!--</dependencies>-->
17+
<dependencies>
18+
<dependency>
19+
<groupId>info.cukes</groupId>
20+
<artifactId>cucumber-android</artifactId>
21+
<version>${project.version}</version>
22+
<type>apklib</type>
23+
</dependency>
24+
<dependency>
25+
<groupId>info.cukes</groupId>
26+
<artifactId>cucumber-core</artifactId>
27+
</dependency>
28+
<dependency>
29+
<groupId>info.cukes</groupId>
30+
<artifactId>cucumber-java</artifactId>
31+
</dependency>
32+
</dependencies>
4333

4434
<build>
4535
<sourceDirectory>src</sourceDirectory>
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
target=android-8
1+
target=android-18
22
android.library=false
3-
android.library.reference.1=../../../android
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
*.iml
2+
*.class
3+
local.properties
4+
.idea/
5+
bin/
6+
gen/
7+
out/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="cucumber.example.android.cukeulator"
4+
android:versionCode="1"
5+
android:versionName="1.0">
6+
7+
<uses-sdk
8+
android:minSdkVersion="8"
9+
android:targetSdkVersion="18"/>
10+
<application
11+
android:label="@string/app_name"
12+
android:icon="@drawable/ic_launcher">
13+
<activity
14+
android:name=".CalculatorActivity">
15+
<intent-filter>
16+
<action android:name="android.intent.action.MAIN"/>
17+
<category android:name="android.intent.category.LAUNCHER"/>
18+
</intent-filter>
19+
</activity>
20+
</application>
21+
</manifest>

examples/android/cukeulator/README.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## Cukeulator Example App
2+
This is a simple Android example application for illustration purposes.
3+
4+
### Build with ant
5+
See ["Building and Running from the Command Line"](https://developer.android.com/tools/building/building-cmdline.html).
6+
7+
### Build with Eclipse
8+
See ["Building and Running from Eclipse with ADT"](https://developer.android.com/tools/building/building-eclipse.html).
9+
10+
### Build with Maven
11+
To build:
12+
13+
`mvn package -pl examples/android/cukeulator -am -P android-examples`
14+
15+
To intall:
16+
17+
`mvn android:deploy -pl examples/android/cukeulator -P android-examples`
18+
19+
To run:
20+
21+
`mvn android:run -pl examples/android/cukeulator -P android-examples`
22+
23+
View all available goals:
24+
25+
`mvn android:help -pl examples/android/cukeulator -P android-examples`
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# This file is used to override default values used by the Ant build system.
2+
#
3+
# This file must be checked into Version Control Systems, as it is
4+
# integral to the build system of your project.
5+
6+
# This file is only used by the Ant script.
7+
8+
# You can use this to override default values such as
9+
# 'source.dir' for the location of your java source folder and
10+
# 'out.dir' for the location of your output folder.
11+
12+
# You can also use it define how the release builds are signed by declaring
13+
# the following properties:
14+
# 'key.store' for the location of your keystore and
15+
# 'key.alias' for the name of the key to use.
16+
# The password will be asked during the build when you use the 'release' target.

examples/android/cukeulator/build.xml

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project name="AndroidCucumberExample" default="help">
3+
4+
<!-- The local.properties file is created and updated by the 'android' tool.
5+
It contains the path to the SDK. It should *NOT* be checked into
6+
Version Control Systems. -->
7+
<property file="local.properties"/>
8+
9+
<!-- The ant.properties file can be created by you. It is only edited by the
10+
'android' tool to add properties to it.
11+
This is the place to change some Ant specific build properties.
12+
Here are some properties you may want to change/update:
13+
14+
source.dir
15+
The name of the source directory. Default is 'src'.
16+
out.dir
17+
The name of the output directory. Default is 'bin'.
18+
19+
For other overridable properties, look at the beginning of the rules
20+
files in the SDK, at tools/ant/build.xml
21+
22+
Properties related to the SDK location or the project target should
23+
be updated using the 'android' tool with the 'update' action.
24+
25+
This file is an integral part of the build system for your
26+
application and should be checked into Version Control Systems.
27+
28+
-->
29+
<property file="ant.properties"/>
30+
31+
<!-- if sdk.dir was not set from one of the property file, then
32+
get it from the ANDROID_HOME env var.
33+
This must be done before we load project.properties since
34+
the proguard config can use sdk.dir -->
35+
<property environment="env"/>
36+
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
37+
<isset property="env.ANDROID_HOME"/>
38+
</condition>
39+
40+
<!-- The project.properties file is created and updated by the 'android'
41+
tool, as well as ADT.
42+
43+
This contains project specific properties such as project target, and library
44+
dependencies. Lower level build properties are stored in ant.properties
45+
(or in .classpath for Eclipse projects).
46+
47+
This file is an integral part of the build system for your
48+
application and should be checked into Version Control Systems. -->
49+
<loadproperties srcFile="project.properties"/>
50+
51+
<!-- quick check on sdk.dir -->
52+
<fail
53+
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
54+
unless="sdk.dir"
55+
/>
56+
57+
<!--
58+
Import per project custom build rules if present at the root of the project.
59+
This is the place to put custom intermediary targets such as:
60+
-pre-build
61+
-pre-compile
62+
-post-compile (This is typically used for code obfuscation.
63+
Compiled code location: ${out.classes.absolute.dir}
64+
If this is not done in place, override ${out.dex.input.absolute.dir})
65+
-post-package
66+
-post-build
67+
-pre-clean
68+
-->
69+
<import file="custom_rules.xml" optional="true"/>
70+
71+
<!-- Import the actual build file.
72+
73+
To customize existing targets, there are two options:
74+
- Customize only one target:
75+
- copy/paste the target into this file, *before* the
76+
<import> task.
77+
- customize it to your needs.
78+
- Customize the whole content of build.xml
79+
- copy/paste the content of the rules files (minus the top node)
80+
into this file, replacing the <import> task.
81+
- customize to your needs.
82+
83+
***********************
84+
****** IMPORTANT ******
85+
***********************
86+
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
87+
in order to avoid having your file be overridden by tools such as "android update project"
88+
-->
89+
<!-- version-tag: 1 -->
90+
<import file="${sdk.dir}/tools/ant/build.xml"/>
91+
92+
</project>

examples/android/cukeulator/pom.xml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<parent>
7+
<groupId>info.cukes.android-examples</groupId>
8+
<artifactId>android-examples</artifactId>
9+
<relativePath>../pom.xml</relativePath>
10+
<version>1.1.5-SNAPSHOT</version>
11+
</parent>
12+
13+
<artifactId>android-example</artifactId>
14+
<packaging>apk</packaging>
15+
<name>Examples: Android Cukeulator</name>
16+
17+
<build>
18+
<sourceDirectory>src</sourceDirectory>
19+
<plugins>
20+
<plugin>
21+
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
22+
<artifactId>android-maven-plugin</artifactId>
23+
<extensions>true</extensions>
24+
</plugin>
25+
</plugins>
26+
</build>
27+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# To enable ProGuard in your project, edit project.properties
2+
# to define the proguard.config property as described in that file.
3+
#
4+
# Add project specific ProGuard rules here.
5+
# By default, the flags in this file are appended to flags specified
6+
# in ${sdk.dir}/tools/proguard/proguard-android.txt
7+
# You can edit the include path and order by changing the ProGuard
8+
# include property in project.properties.
9+
#
10+
# For more details, see
11+
# http://developer.android.com/guide/developing/tools/proguard.html
12+
13+
# Add any project specific keep options here:
14+
15+
# If your project uses WebView with JS, uncomment the following
16+
# and specify the fully qualified class name to the JavaScript interface
17+
# class:
18+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19+
# public *;
20+
#}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This file is automatically generated by Android Tools.
2+
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3+
#
4+
# This file must be checked in Version Control Systems.
5+
#
6+
# To customize properties used by the Ant build system edit
7+
# "ant.properties", and override values to adapt the script to your
8+
# project structure.
9+
#
10+
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11+
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12+
13+
# Project target.
14+
target=android-18
15+
android.library=false
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)