Class: Scoutui::Commands::Command
- Inherits:
-
Object
- Object
- Scoutui::Commands::Command
- Defined in:
- lib/scoutui/commands/command.rb
Direct Known Subclasses
AssignVar, ClickObject, Connect, DefineCommands, DumpVars, ExecuteCommands, ExistsAlert, FillForm, Highlight, JsAlert::ExistsAlert, LoadDB, LoadData, LoadJs, LoadRequirements, MouseOver, Pause, SelectObject, SelectWindow, Sleep, SubmitForm, SwitchFrame, Type, UpdateUrl, UploadFiles, VerifyElement, VerifyForm
Instance Attribute Summary collapse
-
#bm ⇒ Object
Returns the value of attribute bm.
-
#cmd ⇒ Object
Returns the value of attribute cmd.
-
#description ⇒ Object
Returns the value of attribute description.
-
#drv ⇒ Object
Returns the value of attribute drv.
-
#enableAssert ⇒ Object
Returns the value of attribute enableAssert.
-
#executed ⇒ Object
Returns the value of attribute executed.
-
#executed_result ⇒ Object
Returns the value of attribute executed_result.
-
#locator ⇒ Object
Returns the value of attribute locator.
-
#rc ⇒ Object
Returns the value of attribute rc.
-
#stanza ⇒ Object
Returns the value of attribute stanza.
Instance Method Summary collapse
- #assert? ⇒ Boolean
- #disableAssert ⇒ Object
- #disableAsserts ⇒ Object
- #enableAsserts ⇒ Object
- #execute(_drv = nil, _dut = nil) ⇒ Object
- #executedResult ⇒ Object
- #getLocator ⇒ Object
-
#initialize(_cmd, _drv = nil) ⇒ Command
constructor
A new instance of Command.
- #passed? ⇒ Boolean
- #result ⇒ Object
-
#run(opts) ⇒ Object
(_drv=nil, _dut=nil).
- #setBenchmark(b) ⇒ Object
- #setLocator(_locator) ⇒ Object
- #setResult(r) ⇒ Object
- #wasExecuted? ⇒ Boolean
Constructor Details
#initialize(_cmd, _drv = nil) ⇒ Command
Returns a new instance of Command.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/scoutui/commands/command.rb', line 17 def initialize(_cmd, _drv=nil) Scoutui::Logger::LogMgr.instance.commands.debug __FILE__ + (__LINE__).to_s + " Command.init: #{_cmd.to_s}" @enableAssert=true @bm=nil @cmd=_cmd if _cmd.is_a?(Hash) && _cmd.has_key?('page') && _cmd['page'].has_key?('action') @stanza = _cmd @cmd=_cmd['page']['action'] end @rc=nil @drv=_drv @locator=nil @executed=false @executed_result=nil end |
Instance Attribute Details
#bm ⇒ Object
Returns the value of attribute bm.
14 15 16 |
# File 'lib/scoutui/commands/command.rb', line 14 def bm @bm end |
#cmd ⇒ Object
Returns the value of attribute cmd.
8 9 10 |
# File 'lib/scoutui/commands/command.rb', line 8 def cmd @cmd end |
#description ⇒ Object
Returns the value of attribute description.
6 7 8 |
# File 'lib/scoutui/commands/command.rb', line 6 def description @description end |
#drv ⇒ Object
Returns the value of attribute drv.
7 8 9 |
# File 'lib/scoutui/commands/command.rb', line 7 def drv @drv end |
#enableAssert ⇒ Object
Returns the value of attribute enableAssert.
15 16 17 |
# File 'lib/scoutui/commands/command.rb', line 15 def enableAssert @enableAssert end |
#executed ⇒ Object
Returns the value of attribute executed.
11 12 13 |
# File 'lib/scoutui/commands/command.rb', line 11 def executed @executed end |
#executed_result ⇒ Object
Returns the value of attribute executed_result.
12 13 14 |
# File 'lib/scoutui/commands/command.rb', line 12 def executed_result @executed_result end |
#locator ⇒ Object
Returns the value of attribute locator.
10 11 12 |
# File 'lib/scoutui/commands/command.rb', line 10 def locator @locator end |
#rc ⇒ Object
Returns the value of attribute rc.
9 10 11 |
# File 'lib/scoutui/commands/command.rb', line 9 def rc @rc end |
#stanza ⇒ Object
Returns the value of attribute stanza.
13 14 15 |
# File 'lib/scoutui/commands/command.rb', line 13 def stanza @stanza end |
Instance Method Details
#assert? ⇒ Boolean
36 37 38 |
# File 'lib/scoutui/commands/command.rb', line 36 def assert? @enableAssert end |
#disableAssert ⇒ Object
46 47 48 |
# File 'lib/scoutui/commands/command.rb', line 46 def disableAssert() disableAsserts end |
#disableAsserts ⇒ Object
50 51 52 |
# File 'lib/scoutui/commands/command.rb', line 50 def disableAsserts() @enableAssert=false end |
#enableAsserts ⇒ Object
43 44 45 |
# File 'lib/scoutui/commands/command.rb', line 43 def enableAsserts() @enableAssert=true end |
#execute(_drv = nil, _dut = nil) ⇒ Object
99 100 101 |
# File 'lib/scoutui/commands/command.rb', line 99 def execute(_drv=nil, _dut=nil) raise NotImplementedError end |
#executedResult ⇒ Object
60 61 62 |
# File 'lib/scoutui/commands/command.rb', line 60 def executedResult @executed_result end |
#getLocator ⇒ Object
72 73 74 |
# File 'lib/scoutui/commands/command.rb', line 72 def getLocator() @locator end |
#passed? ⇒ Boolean
80 81 82 |
# File 'lib/scoutui/commands/command.rb', line 80 def passed? !@executed_result.nil? && @executed_result end |
#result ⇒ Object
84 85 86 |
# File 'lib/scoutui/commands/command.rb', line 84 def result @rc end |
#run(opts) ⇒ Object
(_drv=nil, _dut=nil)
88 89 90 91 92 93 94 95 96 97 |
# File 'lib/scoutui/commands/command.rb', line 88 def run(opts) # (_drv=nil, _dut=nil) _drv=opts[:driver] _dut=opts.has_key?(:dut) ? opts[:dut] : nil Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " = start run(#{@cmd}) =" @bm=Benchmark.measure { execute(_drv, _dut) } Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " = end run(#{@cmd}) : #{@bm.real}" Scoutui::Logger::LogMgr.instance.benchmarks.info "#{@cmd} => #{@bm.real}" end |
#setBenchmark(b) ⇒ Object
76 77 78 |
# File 'lib/scoutui/commands/command.rb', line 76 def setBenchmark(b) @bm=b end |
#setLocator(_locator) ⇒ Object
68 69 70 |
# File 'lib/scoutui/commands/command.rb', line 68 def setLocator(_locator) @locator=_locator end |
#setResult(r) ⇒ Object
54 55 56 57 58 |
# File 'lib/scoutui/commands/command.rb', line 54 def setResult(r) Scoutui::Logger::LogMgr.instance.commands.debug " #{@cmd.to_s} : setResult(#{r.to_s})" @executed=true @executed_result=r end |
#wasExecuted? ⇒ Boolean
64 65 66 |
# File 'lib/scoutui/commands/command.rb', line 64 def wasExecuted? @executed end |