Class: Xcmonkey
- Inherits:
-
Object
- Object
- Xcmonkey
- Defined in:
- lib/xcmonkey.rb,
lib/xcmonkey/version.rb
Constant Summary collapse
- VERSION =
'1.3.1'
Instance Attribute Summary collapse
-
#driver ⇒ Object
Returns the value of attribute driver.
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
- #ensure_required_params ⇒ Object
- #gestures ⇒ Object
-
#initialize(params) ⇒ Xcmonkey
constructor
A new instance of Xcmonkey.
- #run ⇒ Object
Constructor Details
#initialize(params) ⇒ Xcmonkey
Returns a new instance of Xcmonkey.
12 13 14 15 16 17 18 19 |
# File 'lib/xcmonkey.rb', line 12 def initialize(params) params[:event_count] = 60 if params[:event_count].nil? params[:ignore_crashes] = false if params[:ignore_crashes].nil? params[:disable_simulator_keyboard] = false if params[:disable_simulator_keyboard].nil? self.params = params self.driver = Driver.new(params) ensure_required_params end |
Instance Attribute Details
#driver ⇒ Object
Returns the value of attribute driver.
10 11 12 |
# File 'lib/xcmonkey.rb', line 10 def driver @driver end |
#params ⇒ Object
Returns the value of attribute params.
10 11 12 |
# File 'lib/xcmonkey.rb', line 10 def params @params end |
Instance Method Details
#ensure_required_params ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/xcmonkey.rb', line 32 def ensure_required_params Logger.error('UDID should be provided') if params[:udid].nil? Logger.error('Bundle identifier should be provided') if params[:bundle_id].nil? Logger.error('Session path should be a directory') if params[:session_path] && !File.directory?(params[:session_path]) if params[:event_count].nil? || !params[:event_count].kind_of?(Integer) || !params[:event_count].positive? Logger.error('Event count must be Integer and not less than 1') end end |
#gestures ⇒ Object
25 26 27 28 29 30 |
# File 'lib/xcmonkey.rb', line 25 def gestures taps = params[:exclude_taps] ? [] : [:precise_tap, :blind_tap] * 10 swipes = params[:exclude_swipes] ? [] : [:precise_swipe, :blind_swipe] * 5 presses = params[:exclude_presses] ? [] : [:precise_press, :blind_press] taps + swipes + presses end |
#run ⇒ Object
21 22 23 |
# File 'lib/xcmonkey.rb', line 21 def run driver.monkey_test(gestures) end |