Class: Repeater
- Inherits:
-
Object
- Object
- Repeater
- Defined in:
- lib/xcmonkey/repeater.rb
Instance Attribute Summary collapse
-
#actions ⇒ Object
Returns the value of attribute actions.
-
#bundle_id ⇒ Object
Returns the value of attribute bundle_id.
-
#disable_simulator_keyboard ⇒ Object
Returns the value of attribute disable_simulator_keyboard.
-
#ignore_crashes ⇒ Object
Returns the value of attribute ignore_crashes.
-
#throttle ⇒ Object
Returns the value of attribute throttle.
-
#udid ⇒ Object
Returns the value of attribute udid.
Instance Method Summary collapse
-
#initialize(params) ⇒ Repeater
constructor
A new instance of Repeater.
- #run ⇒ Object
- #validate_session(session_path) ⇒ Object
Constructor Details
#initialize(params) ⇒ Repeater
Returns a new instance of Repeater.
4 5 6 |
# File 'lib/xcmonkey/repeater.rb', line 4 def initialize(params) validate_session(params[:session_path]) end |
Instance Attribute Details
#actions ⇒ Object
Returns the value of attribute actions.
2 3 4 |
# File 'lib/xcmonkey/repeater.rb', line 2 def actions @actions end |
#bundle_id ⇒ Object
Returns the value of attribute bundle_id.
2 3 4 |
# File 'lib/xcmonkey/repeater.rb', line 2 def bundle_id @bundle_id end |
#disable_simulator_keyboard ⇒ Object
Returns the value of attribute disable_simulator_keyboard.
2 3 4 |
# File 'lib/xcmonkey/repeater.rb', line 2 def disable_simulator_keyboard @disable_simulator_keyboard end |
#ignore_crashes ⇒ Object
Returns the value of attribute ignore_crashes.
2 3 4 |
# File 'lib/xcmonkey/repeater.rb', line 2 def ignore_crashes @ignore_crashes end |
#throttle ⇒ Object
Returns the value of attribute throttle.
2 3 4 |
# File 'lib/xcmonkey/repeater.rb', line 2 def throttle @throttle end |
#udid ⇒ Object
Returns the value of attribute udid.
2 3 4 |
# File 'lib/xcmonkey/repeater.rb', line 2 def udid @udid end |
Instance Method Details
#run ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/xcmonkey/repeater.rb', line 8 def run params = { udid: udid, throttle: throttle, bundle_id: bundle_id, ignore_crashes: ignore_crashes, disable_simulator_keyboard: disable_simulator_keyboard, session_actions: actions } Driver.new(params).repeat_monkey_test end |
#validate_session(session_path) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/xcmonkey/repeater.rb', line 20 def validate_session(session_path) Logger.error("Provided session can't be found: #{session_path}") unless File.exist?(session_path) session = JSON.parse(File.read(session_path)) if session['params'].nil? Logger.error('Provided session is not valid: `params` should not be `nil`') return end self.actions = session['actions'] Logger.error('Provided session is not valid: `actions` should not be `nil` or `empty`') if actions.nil? || actions.empty? self.udid = session['params']['udid'] Logger.error('Provided session is not valid: `udid` should not be `nil`') if udid.nil? self.bundle_id = session['params']['bundle_id'] Logger.error('Provided session is not valid: `bundle_id` should not be `nil`') if bundle_id.nil? self.throttle = session['params']['throttle'] self.ignore_crashes = session['params']['ignore_crashes'] self.disable_simulator_keyboard = session['params']['disable_simulator_keyboard'] end |