acouchi 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,12 +1,36 @@
1
1
  Acouchi
2
2
  =======
3
3
 
4
+ WARNING
5
+ -------
6
+
7
+ This gem was initially a spike, and has since then become rather useful. It is very much not unit tested. For this I apologise, and offer up this picture of an [Acouchi](http://en.wikipedia.org/wiki/Acouchi):
8
+
9
+ ![acouchi](https://github.com/AndrewVos/acouchi/raw/master/acouchi.jpg)
10
+
4
11
  Requirements
5
12
  ------------
6
13
 
7
14
  * [Android SDK](http://developer.android.com/sdk/installing/index.html) (Make sure to add SDK/tools and SDK/platform-tools to your PATH)
8
15
  * [apktool](http://code.google.com/p/android-apktool/)
9
16
 
17
+ The Build Process
18
+ -----------------
19
+
20
+ Acouchi needs to make some tweaks to your APK to allow functional testing. This is roughly the process:
21
+
22
+ * Temporarily add some source files, and the Robotium jar file to your project
23
+ * Build your project in debug mode with ant
24
+ * Hack the APK file and inject some need elements in your AndroidManifest.xml
25
+
26
+ Please note that the build only has to happen again if your java code for the application under test changes.
27
+
28
+ How It Works
29
+ ------------
30
+
31
+ Acouchi builds Robotium and a HTTP server into your Android application. Robotium is an API that has some amazing functionality for functional testing on Android.
32
+ In the Ruby API we post method calls via HTTP to the server on your device, which in turn returns meaningful data.
33
+
10
34
  Cucumber
11
35
  --------
12
36
 
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
10
10
  gem.email = ["andrew.vos@gmail.com"]
11
11
  gem.description = %q{}
12
12
  gem.summary = %q{}
13
- gem.homepage = ""
13
+ gem.homepage = "https://github.com/AndrewVos/acouchi"
14
14
 
15
15
  gem.files = `git ls-files`.split($/)
16
16
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
Binary file
@@ -3,3 +3,5 @@ require "acouchi/project_builder"
3
3
  require "acouchi/solo"
4
4
  require "acouchi/test_runner"
5
5
  require "acouchi/configuration"
6
+ require "acouchi/apk_modifier"
7
+ require "acouchi/process_launcher"
@@ -0,0 +1,21 @@
1
+ module Acouchi
2
+ class ProcessLauncher
3
+ def initialize(*arguments)
4
+ @arguments = arguments
5
+ @process = ChildProcess.build(*@arguments)
6
+ @process.io.inherit!
7
+ end
8
+
9
+ def start
10
+ @process.start
11
+ @process.wait
12
+ end
13
+
14
+ def start_and_crash_if_process_fails
15
+ start
16
+ if @process.crashed?
17
+ raise "A process exited with a non-zero exit code.\nThe command executed was \"#{@arguments.join(" ")}\""
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,5 +1,5 @@
1
- require "acouchi/apk_modifier"
2
1
  require "fileutils"
2
+ require "childprocess"
3
3
 
4
4
  module Acouchi
5
5
  JARS_PATH = File.expand_path(File.join(File.dirname(__FILE__), "../../jars"))
@@ -78,14 +78,13 @@ module Acouchi
78
78
 
79
79
  def build_apk
80
80
  Dir.chdir configuration.project_path do
81
- system "ant clean"
82
- system "ant debug"
81
+ ProcessLauncher.new("ant", "clean", "debug").start_and_crash_if_process_fails
83
82
  end
84
83
  end
85
84
 
86
85
  def install_apk apk_path
87
- system "adb uninstall #{configuration.target_package}"
88
- system "adb install #{apk_path}"
86
+ ProcessLauncher.new("adb", "uninstall", configuration.target_package).start
87
+ ProcessLauncher.new("adb", "install", apk_path).start_and_crash_if_process_fails
89
88
  end
90
89
  end
91
90
  end
@@ -1,3 +1,3 @@
1
1
  module Acouchi
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acouchi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-03 00:00:00.000000000 Z
12
+ date: 2012-10-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -56,6 +56,7 @@ files:
56
56
  - README.md
57
57
  - Rakefile
58
58
  - acouchi.gemspec
59
+ - acouchi.jpg
59
60
  - examples/AcouchiSample/AndroidManifest.xml
60
61
  - examples/AcouchiSample/Rakefile
61
62
  - examples/AcouchiSample/acouchi_configuration.json
@@ -77,6 +78,7 @@ files:
77
78
  - lib/acouchi/apk_modifier.rb
78
79
  - lib/acouchi/configuration.rb
79
80
  - lib/acouchi/cucumber.rb
81
+ - lib/acouchi/process_launcher.rb
80
82
  - lib/acouchi/project_builder.rb
81
83
  - lib/acouchi/solo.rb
82
84
  - lib/acouchi/test_runner.rb
@@ -85,7 +87,7 @@ files:
85
87
  - src/com/acouchi/Acouchi.java
86
88
  - src/com/acouchi/NanoHTTPD.java
87
89
  - src/com/acouchi/TestCase.java
88
- homepage: ''
90
+ homepage: https://github.com/AndrewVos/acouchi
89
91
  licenses: []
90
92
  post_install_message:
91
93
  rdoc_options: []