Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Begin to use Test-Driven Development (TDD) process

Use Calabash-Android with Cucumber syntax to test.
Add beginning manuscript and scenario features.
Provide configured build properties.
Pack fixed command into shell script.
Ignore generated test screenshot.
  • Loading branch information...
commit c4cd3fb94b672a339227453747fcbd972166fa9f 1 parent 956a3ed
@mhaidarh authored
View
1  .gitignore
@@ -3,6 +3,7 @@ misc/
tmp/
*.swp
*.jar
+screenshot_*.png
# Backup files
*.un~
View
10 build.properties
@@ -0,0 +1,10 @@
+tested.package_name=com.mhaidarhanif.android.kargu
+tested.main_activity=com.mhaidarhanif.android.kargu
+tested.project.apk=target/kargu.apk
+
+android.api.level=10
+
+key.store=${user.home}/.android/debug.keystore
+key.store.password=android
+key.alias=androiddebugkey
+key.alias.password=android
View
4 features/app_title_id.feature
@@ -0,0 +1,4 @@
+Feature: Title feature
+
+ Scenario: As a valid user I can see my app
+ Then I see "Kargu Listrik"
View
1  features/step_definitions/calabash_steps.rb
@@ -0,0 +1 @@
+require 'calabash-android/calabash_steps'
View
36 features/support/app_installation_hooks.rb
@@ -0,0 +1,36 @@
+require 'calabash-android/management/app_installation'
+
+AfterConfiguration do |config|
+ FeatureNameMemory.feature_name = nil
+end
+
+Before do |scenario|
+ @scenario_is_outline = (scenario.class == Cucumber::Ast::OutlineTable::ExampleRow)
+ if @scenario_is_outline
+ scenario = scenario.scenario_outline
+ end
+
+ feature_name = scenario.feature.title
+ if FeatureNameMemory.feature_name != feature_name \
+ or ENV["RESET_BETWEEN_SCENARIOS"] == "1"
+ if ENV["RESET_BETWEEN_SCENARIOS"] == "1"
+ log "New scenario - reinstalling apps"
+ else
+ log "First scenario in feature - reinstalling apps"
+ end
+
+ uninstall_apps
+ install_app(ENV["TEST_APP_PATH"])
+ install_app(ENV["APP_PATH"])
+ FeatureNameMemory.feature_name = feature_name
+ FeatureNameMemory.invocation = 1
+ else
+ FeatureNameMemory.invocation += 1
+ end
+end
+
+FeatureNameMemory = Class.new
+class << FeatureNameMemory
+ @feature_name = nil
+ attr_accessor :feature_name, :invocation
+end
View
13 features/support/app_life_cycle_hooks.rb
@@ -0,0 +1,13 @@
+require 'calabash-android/management/adb'
+require 'calabash-android/operations'
+
+Before do |scenario|
+ start_test_server_in_background
+end
+
+After do |scenario|
+ if scenario.failed?
+ screenshot_embed
+ end
+ shutdown_test_server
+end
View
1  features/support/env.rb
@@ -0,0 +1 @@
+require 'calabash-android/cucumber'
View
0  features/support/hooks.rb
No changes.
View
4 res/layout/activity_main.xml
@@ -41,7 +41,9 @@
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
- android:focusable="true"/>
+ android:focusable="true"
+ android:singleLine="true"
+ android:inputType="numberDecimal"/>
</LinearLayout>
View
0  sh/run_calabash.sh → run_calabash.sh
File renamed without changes
View
15 tests/manuscript.mkd
@@ -0,0 +1,15 @@
+0. Selamat datang di aplikasi Kargu! Sekarang adalah pertama kali Anda menggunakan Kargu. Silakan ikuti petunjuk penggunaan berikut.
+ * Tombol: Lanjut
+1. Untuk memulai perhitungan, Anda perlu mengetahui:
+ - Batas daya listrik bangunan seperti rumah atau kamar
+ - Alat elektronik apa saja yang digunakan
+ - Waktu penggunaan rata-rata sehari dalam jam
+ * Tombol: Lanjut
+2. Masukkan nilai daya listrik (dalam VA atau Volt Ampere)
+ * Tombol: Lanjut
+3. Pilih alat elektronik yang tersedia atau tambahkan sendiri
+ - Jika memilih yang sudah ada, beri nilai waktu
+ - Jika menambah sendiri, beri nilai Watt dan waktu
+ * Tombol: Lanjut
+4. Tekan tombol hitung dan silakan lihat hasil laporannya
+ * Tombol: Coba
Please sign in to comment.
Something went wrong with that request. Please try again.