crash_monkey 0.2.5 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +10 -11
- data/README.md +7 -1
- data/VERSION +1 -1
- data/bin/crash_monkey +4 -2
- data/lib/crash_monkey/monkey_runner.rb +17 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1979b40cce8bf2c1b770ade1732f143a3969c599
|
4
|
+
data.tar.gz: 3766534b86c538ad577e0623812c6361b0ee5d9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 465a9a9bac762efd27441a6a04e1bfdee24cb18019478d0c2af8a05d028d75fb969aa30a3fa19ca67677fea9876b416e4d518e96c3f9e102c6a6f5192665dee8
|
7
|
+
data.tar.gz: c0e4f55852c20b2508a3779f88d7e6404a06610da9a2954060f8d5fc95bd3f56ac97e89e9259d423f21c05142bda2c2b1e2d01737d4e496ea82c8564cf9d7bc6
|
data/Gemfile.lock
CHANGED
@@ -4,11 +4,11 @@ GEM
|
|
4
4
|
addressable (2.3.6)
|
5
5
|
builder (3.2.2)
|
6
6
|
diff-lcs (1.1.3)
|
7
|
-
docile (1.1.
|
7
|
+
docile (1.1.5)
|
8
8
|
erubis (2.7.0)
|
9
9
|
faraday (0.8.9)
|
10
10
|
multipart-post (~> 1.2.0)
|
11
|
-
git (1.2.
|
11
|
+
git (1.2.8)
|
12
12
|
github_api (0.10.1)
|
13
13
|
addressable
|
14
14
|
faraday (~> 0.8.1)
|
@@ -16,7 +16,7 @@ GEM
|
|
16
16
|
multi_json (~> 1.4)
|
17
17
|
nokogiri (~> 1.5.2)
|
18
18
|
oauth2
|
19
|
-
hashie (
|
19
|
+
hashie (3.3.1)
|
20
20
|
highline (1.6.21)
|
21
21
|
jeweler (1.8.8)
|
22
22
|
builder
|
@@ -28,20 +28,19 @@ GEM
|
|
28
28
|
rake
|
29
29
|
rdoc
|
30
30
|
json (1.8.1)
|
31
|
-
jwt (0.
|
32
|
-
|
33
|
-
multi_json (1.9.2)
|
31
|
+
jwt (1.0.0)
|
32
|
+
multi_json (1.10.1)
|
34
33
|
multi_xml (0.5.5)
|
35
34
|
multipart-post (1.2.0)
|
36
35
|
nokogiri (1.5.10)
|
37
|
-
oauth2 (0.
|
36
|
+
oauth2 (1.0.0)
|
38
37
|
faraday (>= 0.8, < 0.10)
|
39
|
-
jwt (~>
|
38
|
+
jwt (~> 1.0)
|
40
39
|
multi_json (~> 1.3)
|
41
40
|
multi_xml (~> 0.5)
|
42
41
|
rack (~> 1.2)
|
43
42
|
rack (1.5.2)
|
44
|
-
rake (10.
|
43
|
+
rake (10.3.2)
|
45
44
|
rdoc (3.12.2)
|
46
45
|
json (~> 1.4)
|
47
46
|
rspec (2.8.0)
|
@@ -52,9 +51,9 @@ GEM
|
|
52
51
|
rspec-expectations (2.8.0)
|
53
52
|
diff-lcs (~> 1.1.2)
|
54
53
|
rspec-mocks (2.8.0)
|
55
|
-
simplecov (0.
|
54
|
+
simplecov (0.9.1)
|
56
55
|
docile (~> 1.1.0)
|
57
|
-
multi_json
|
56
|
+
multi_json (~> 1.0)
|
58
57
|
simplecov-html (~> 0.8.0)
|
59
58
|
simplecov-html (0.8.0)
|
60
59
|
|
data/README.md
CHANGED
@@ -52,10 +52,11 @@ How to use
|
|
52
52
|
### Simple Usage
|
53
53
|
|
54
54
|
```
|
55
|
-
crash_monkey -a <APP_NAME or APP_PATH>
|
55
|
+
crash_monkey -a <APP_NAME or APP_PATH> -w <DEVICE>
|
56
56
|
```
|
57
57
|
|
58
58
|
`-a` specify AppName or PATH.
|
59
|
+
`-w` specify the device on which to run. A list of available devices can be obtained with `crash_monkey --list-devices`. In case no device is specified, it will take the first from the list.
|
59
60
|
|
60
61
|
|
61
62
|
#### Example
|
@@ -78,6 +79,7 @@ crash_monkey -a ~/Library/Developer/Xcode/DerivedData/MyAwesomeApp-ffumcy/Build/
|
|
78
79
|
% crash_monkey
|
79
80
|
Usage: crash_monkey [options]
|
80
81
|
-a app_name Target Application(Required)
|
82
|
+
-w device Target Device(Required)
|
81
83
|
-n run_count How many times monkeys run(default: 2)
|
82
84
|
-d result_dir Where to output result(default: ./crash_monkey_result)
|
83
85
|
-t time_limit_sec Time limit of running(default: 100 sec)
|
@@ -85,6 +87,7 @@ Usage: crash_monkey [options]
|
|
85
87
|
-e extend_javascript_path Extend Uiautomation Javascript for such Login scripts
|
86
88
|
--show-config Show Current Configuration JSON
|
87
89
|
--list-app Show List of Installed Apps in iOS Simulator
|
90
|
+
--list-devices Show List of Devices
|
88
91
|
--reset-iPhone-Simulator Reset iPhone Simulator
|
89
92
|
```
|
90
93
|
|
@@ -112,6 +115,9 @@ Output configuration for UIAutomation library by JSON format.([example](https://
|
|
112
115
|
#### --list-app
|
113
116
|
List apps for iPhone Simulator.
|
114
117
|
|
118
|
+
#### --list-devices
|
119
|
+
List devices (simulator and attached) on which the monkey can be run.
|
120
|
+
|
115
121
|
#### --reset-iPhone-Simulator.
|
116
122
|
Reset iPhone Simulator.
|
117
123
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/bin/crash_monkey
CHANGED
@@ -10,6 +10,7 @@ require 'crash_monkey'
|
|
10
10
|
opts = {}
|
11
11
|
ARGV.options do |o|
|
12
12
|
o.on('-a app_name', 'Target Application(Required)') {|b| opts[:app_path] = b}
|
13
|
+
o.on('-w device', 'Target Device(Required)') {|b| opts[:device] = b}
|
13
14
|
o.on('-n run_count', 'How many times monkeys run(default: 2)') {|b| opts[:run_count] = b.to_i}
|
14
15
|
o.on('-d result_dir', 'Where to output result(default: ./crash_monkey_result)') {|b| opts[:result_base_dir] = File.expand_path(b)}
|
15
16
|
o.on('-t time_limit_sec', 'Time limit of running(default: 100 sec)') {|b| opts[:time_limit_sec] = b.to_i}
|
@@ -17,6 +18,7 @@ ARGV.options do |o|
|
|
17
18
|
o.on('-e extend_javascript_path', 'Extend Uiautomation Javascript for such Login scripts') {|b| opts[:extend_javascript_path] = File.expand_path(b)}
|
18
19
|
o.on('--show-config', 'Show Current Configuration JSON') {|_| opts[:show_config] = true}
|
19
20
|
o.on('--list-app', 'Show List of Installed Apps in iOS Simulator') {|_| opts[:list_app] = true}
|
21
|
+
o.on('--list-devices', 'Show List of Devices') {|_| opts[:list_devices] = true}
|
20
22
|
o.on('--reset-iPhone-Simulator', 'Reset iPhone Simulator'){|_| opts[:reset_iphone_simulator] = true}
|
21
23
|
o.on('--version', 'print crash monkey version'){|_| opts[:version] = true}
|
22
24
|
o.parse!
|
@@ -29,7 +31,7 @@ if opts[:version]
|
|
29
31
|
exit(1)
|
30
32
|
end
|
31
33
|
|
32
|
-
unless opts[:app_path] || opts[:show_config] || opts[:list_app] || opts[:reset_iphone_simulator]
|
34
|
+
unless opts[:app_path] || opts[:show_config] || opts[:list_app] || opts[:reset_iphone_simulator] || opts[:list_devices]
|
33
35
|
puts ARGV.options.help
|
34
36
|
exit(1)
|
35
37
|
end
|
@@ -39,6 +41,6 @@ opts[:time_limit_sec] ||= 100
|
|
39
41
|
|
40
42
|
result_ok = UIAutoMonkey::MonkeyRunner.new.run(opts)
|
41
43
|
|
42
|
-
puts result_ok ? 'EXIT 0' : 'EXIT 1' unless opts[:show_config] || opts[:list_app]
|
44
|
+
puts result_ok ? 'EXIT 0' : 'EXIT 1' unless opts[:show_config] || opts[:list_app] || opts[:list_devices]
|
43
45
|
|
44
46
|
exit(result_ok ? 0 : 1)
|
@@ -8,7 +8,7 @@ module UIAutoMonkey
|
|
8
8
|
require 'json'
|
9
9
|
|
10
10
|
class MonkeyRunner
|
11
|
-
TRACE_TEMPLATE='/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.
|
11
|
+
TRACE_TEMPLATE='/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate'
|
12
12
|
RESULT_BASE_PATH = File.expand_path('crash_monkey_result')
|
13
13
|
RESULT_DETAIL_EVENT_NUM = 20
|
14
14
|
TIME_LIMIT_SEC = 100
|
@@ -23,6 +23,9 @@ module UIAutoMonkey
|
|
23
23
|
elsif @options[:list_app]
|
24
24
|
list_app
|
25
25
|
return true
|
26
|
+
elsif @options[:list_devices]
|
27
|
+
list_devices
|
28
|
+
return true
|
26
29
|
elsif @options[:reset_iphone_simulator]
|
27
30
|
reset_iphone_simulator
|
28
31
|
return true
|
@@ -65,7 +68,7 @@ module UIAutoMonkey
|
|
65
68
|
watch_syslog do
|
66
69
|
begin
|
67
70
|
Timeout.timeout(time_limit_sec + 5) do
|
68
|
-
run_process(%W(instruments -l #{time_limit} -t #{TRACE_TEMPLATE} #{app_path} -e UIASCRIPT #{ui_auto_monkey_path} -e UIARESULTSPATH #{result_base_dir}))
|
71
|
+
run_process(%W(instruments -w #{device} -l #{time_limit} -t #{TRACE_TEMPLATE} #{app_path} -e UIASCRIPT #{ui_auto_monkey_path} -e UIARESULTSPATH #{result_base_dir}))
|
69
72
|
end
|
70
73
|
rescue Timeout::Error
|
71
74
|
log 'killall -9 instruments'
|
@@ -132,6 +135,10 @@ module UIAutoMonkey
|
|
132
135
|
puts find_apps('*.app').map{|n| File.basename n}.uniq.sort.join("\n")
|
133
136
|
end
|
134
137
|
|
138
|
+
def list_devices
|
139
|
+
puts devices.join("\n")
|
140
|
+
end
|
141
|
+
|
135
142
|
def log(msg)
|
136
143
|
puts msg
|
137
144
|
end
|
@@ -145,6 +152,10 @@ module UIAutoMonkey
|
|
145
152
|
(@options[:run_count] || 2)
|
146
153
|
end
|
147
154
|
|
155
|
+
def device
|
156
|
+
@options[:device] || devices[0]
|
157
|
+
end
|
158
|
+
|
148
159
|
def app_path
|
149
160
|
@app_path ||= find_app_path(@options)
|
150
161
|
end
|
@@ -157,6 +168,10 @@ module UIAutoMonkey
|
|
157
168
|
`"ls" -dt #{ENV['HOME']}/Library/Developer/Xcode/DerivedData/*/Build/Products/*/#{app}`.strip.split(/\n/)
|
158
169
|
end
|
159
170
|
|
171
|
+
def devices
|
172
|
+
`"instruments" -s devices`.strip.split(/\n/).drop(2)
|
173
|
+
end
|
174
|
+
|
160
175
|
def find_app_path(opts)
|
161
176
|
app_path = nil
|
162
177
|
if opts[:app_path].include?('/')
|