diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ab02233 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +# Created by .ignore support plugin (hsz.mobi) +.idea +*.iml +local.properties +.gradle +/cucumber-android/build/ + diff --git a/.travis.yml b/.travis.yml index 23df2d1..2ec3053 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,33 +2,42 @@ language: android jdk: oraclejdk8 sudo: false -cache: - directories: - - "$HOME/.m2" - -before_cache: -- rm -rf $HOME/.m2/repository/io/cucumber - android: components: - - tools - - platform-tools - - tools - - build-tools-26.0.0 - - android-21 - - sys-img-armeabi-v7a-android-21 + - build-tools-28.0.2 + - android-21 + +before_cache: + - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock + - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ +cache: + directories: + - $HOME/.gradle/caches/ + - $HOME/.gradle/wrapper/ + - $HOME/.android/build-cache before_install: - - echo no | android create avd --force -n test -t android-21 --abi armeabi-v7a - - emulator -avd test -no-skin -no-audio -no-window & + - yes | sdkmanager tools + - yes | sdkmanager "platform-tools" + - yes | sdkmanager "emulator" + - yes | sdkmanager "build-tools;28.0.2" + - yes | sdkmanager "system-images;android-21;default;armeabi-v7a" + - echo no | avdmanager create avd --force -n test -k "system-images;android-21;default;armeabi-v7a" -c 200M + - $ANDROID_HOME/emulator/emulator -avd test -skin 1920x1080 -no-audio -no-window -no-boot-anim & install: - - mvn -q install --also-make --projects android,picocontainer -DskipTests=true - -Dmaven.javadoc.skip=true + - ./gradlew clean build before_script: - android-wait-for-emulator + - adb shell input keyevent 82 + - adb logcat *:e & script: - - mvn install --activate-profiles android-examples --projects examples/android - --also-make-dependents -Dandroid.device=test + - ./gradlew runInstrumentationTests + +deploy: + provider: script + script: ./gradlew publish + on: + branch: master diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..9aa839c --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,13 @@ +## 4.0.0-SNAPSHOT + +### Changed + * migrate everything to Gradle + +### Removed + * android-studio sample - now [cukeulator](https://github.com/cucumber/cucumber-android/tree/master/cukeulator) is the only valid sample (for Gradle and Android Studio) + * cukeulator-test and cucumber-android-test + +### Fixed + * [#5](https://github.com/cucumber/cucumber-android/issues/5) - Sample Does Not Work + * [#4](https://github.com/cucumber/cucumber-android/issues/4) - Support for parallel cukes + * [#3](https://github.com/cucumber/cucumber-android/issues/3) - Reported duration time of scenario is about 0ms on Android \ No newline at end of file diff --git a/README.md b/README.md index fdeed65..69e6edb 100644 --- a/README.md +++ b/README.md @@ -13,12 +13,12 @@ Taken from the [maven-android-plugin](https://code.google.com/p/maven-android-pl 1. JDK 1.6+ installed as required for Android development 2. [Android SDK](http://developer.android.com/sdk/index.html) (r21 or later, latest is best supported) installed, preferably with all platforms. -Integration-tests are in `examples/android/android-test/cucumber-test/`. +Integration-tests are in `cukeulator/src/androidTest`. ### Building ```sh -mvn package -pl android -am +./gradlew assemble ``` ### Setting up the dependency @@ -66,24 +66,7 @@ Please read [the Android documentation on debugging](https://developer.android.c ### Examples -To *build* all android example modules with maven: - -``` -mvn package -pl examples/android -am -amd -P android,android-examples -``` - -To *clean* all android example modules with maven: - -``` -mvn clean -pl examples/android -amd -P android-examples -``` - -The example projects depend on the current (unreleased) Cucumber-JVM modules. -If any of the examples fail to build, just build the android module and its dependencies once first: - -``` -mvn clean install -pl android -am -``` +Currently there is one example in subproject [cukeulator](https://github.com/cucumber/cucumber-android/tree/master/cukeulator) To create a virtual device and start an [Android emulator](https://developer.android.com/tools/devices/index.html): diff --git a/android-studio/Cukeulator/.gitignore b/android-studio/Cukeulator/.gitignore deleted file mode 100644 index 4c5d941..0000000 --- a/android-studio/Cukeulator/.gitignore +++ /dev/null @@ -1,28 +0,0 @@ -# Built application files -/*/build/ -build/ - -# Crashlytics configuations -com_crashlytics_export_strings.xml - -# Local configuration file (sdk path, etc) -local.properties - -# Gradle generated files -.gradle/ - -# Signing files -.signing/ - -# User-specific configurations -.idea/ -*.iml - -# OS-specific files -.DS_Store -.DS_Store? -._* -.Spotlight-V100 -.Trashes -ehthumbs.db -Thumbs.db diff --git a/android-studio/Cukeulator/README.md b/android-studio/Cukeulator/README.md deleted file mode 100644 index 85a7000..0000000 --- a/android-studio/Cukeulator/README.md +++ /dev/null @@ -1,73 +0,0 @@ -## Cukeulator Example Test -This is the example test-project for the Cukeulator app for Android Studio 3.0+ - -### Setup -Features must be placed in `assets/features/`. Subdirectories are allowed. - -The rest of the dependencies are added automatically in `app/build.gradle`. - -The cucumber-android dependency is added as (see `app/build.gradle`): - -``` -androidTestCompile 'io.cucumber:cucumber-android:' -``` - -### Using gradle - -To build the test apk: - -``` -cd cucumber-jvm/examples/android/android-studio/Cukeulator - -./gradlew --parallel :app:assembleDebugTest -``` - -The build generates an apk in app/build/outputs/apk/app-debug.apk. - -To install the apk on a device: - -``` -adb install -r app/build/outputs/apk/app-debug.apk -``` - -To verify that the test is installed, run: - -``` -adb shell pm list instrumentation -``` - -The command output should display; - -``` -instrumentation:cucumber.cukeulator.test/cucumber.api.android.CucumberInstrumentation (target=cucumber.cukeulator) -``` - -To run the test: - -``` -cd cucumber-jvm/examples/android/android-studio/Cukeulator; -./gradlew connectedCheck -``` - -As an alternative option, the test can be run with adb: - -``` -adb shell am instrument -w cucumber.cukeulator.test/cucumber.cukeulator.test.Instrumentation -``` - -### Using an Android Studio IDE -1. Import the example to Android Studio: `File > Import Project`. -2. Create a test run configuration: - 1. Run > Edit Configurations - 2. Click `+` button and select Android Tests - 3. Specify test name: `CalculatorTest` - 4. Select module: `app` - 5. Enter a Specific instrumentation runner: `cucumber.cukeulator.test.Instrumentation` - 6. Click Ok - -### Output -Filter for the logcat tag `cucumber-android` in [DDMS](https://developer.android.com/tools/debugging/ddms.html). - -### Using this project with locally built Cucumber-JVM -See [app/build.gradle](app/build.gradle) under `dependencies`. -There is a source-code comment which explains how to use a locally built Cucumber-JVM Android library. \ No newline at end of file diff --git a/android-studio/Cukeulator/app/.gitignore b/android-studio/Cukeulator/app/.gitignore deleted file mode 100644 index 796b96d..0000000 --- a/android-studio/Cukeulator/app/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build diff --git a/android-studio/Cukeulator/app/proguard-rules.pro b/android-studio/Cukeulator/app/proguard-rules.pro deleted file mode 100644 index 178b533..0000000 --- a/android-studio/Cukeulator/app/proguard-rules.pro +++ /dev/null @@ -1,17 +0,0 @@ -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in /Users/mdzyuba/Code/android/adt-bundle-mac-x86_64-20140702/sdk/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/android-studio/Cukeulator/app/src/main/AndroidManifest.xml b/android-studio/Cukeulator/app/src/main/AndroidManifest.xml deleted file mode 100644 index 3f5d610..0000000 --- a/android-studio/Cukeulator/app/src/main/AndroidManifest.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - diff --git a/android-studio/Cukeulator/app/src/main/res/drawable-hdpi/ic_launcher.png b/android-studio/Cukeulator/app/src/main/res/drawable-hdpi/ic_launcher.png deleted file mode 100755 index 019f515..0000000 Binary files a/android-studio/Cukeulator/app/src/main/res/drawable-hdpi/ic_launcher.png and /dev/null differ diff --git a/android-studio/Cukeulator/app/src/main/res/drawable-mdpi/ic_launcher.png b/android-studio/Cukeulator/app/src/main/res/drawable-mdpi/ic_launcher.png deleted file mode 100755 index 1838c33..0000000 Binary files a/android-studio/Cukeulator/app/src/main/res/drawable-mdpi/ic_launcher.png and /dev/null differ diff --git a/android-studio/Cukeulator/app/src/main/res/drawable-xhdpi/ic_launcher.png b/android-studio/Cukeulator/app/src/main/res/drawable-xhdpi/ic_launcher.png deleted file mode 100755 index 2f5cc8f..0000000 Binary files a/android-studio/Cukeulator/app/src/main/res/drawable-xhdpi/ic_launcher.png and /dev/null differ diff --git a/android-studio/Cukeulator/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/android-studio/Cukeulator/app/src/main/res/drawable-xxhdpi/ic_launcher.png deleted file mode 100755 index 1814a25..0000000 Binary files a/android-studio/Cukeulator/app/src/main/res/drawable-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/android-studio/Cukeulator/app/src/main/res/layout/activity_calculator.xml b/android-studio/Cukeulator/app/src/main/res/layout/activity_calculator.xml deleted file mode 100644 index 9956688..0000000 --- a/android-studio/Cukeulator/app/src/main/res/layout/activity_calculator.xml +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - - - - - -