Class: Scoutui::Commands::DefineCommands
- Defined in:
- lib/scoutui/commands/define_commands.rb
Instance Attribute Summary
Attributes inherited from Command
#bm, #cmd, #description, #drv, #enableAssert, #executed, #executed_result, #locator, #rc, #stanza
Instance Method Summary collapse
Methods inherited from Command
#assert?, #disableAssert, #disableAsserts, #enableAsserts, #executedResult, #getLocator, #initialize, #passed?, #result, #run, #setBenchmark, #setLocator, #setResult, #wasExecuted?
Constructor Details
This class inherits a constructor from Scoutui::Commands::Command
Instance Method Details
#execute(drv, e = nil) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/scoutui/commands/define_commands.rb', line 8 def execute(drv, e=nil) @drv=drv if !drv.nil? rc=false obj=nil _locator=nil _req = Scoutui::Utils::TestUtils.instance.getReq() begin Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " DefineCommand()" if e['page'].has_key?('id') && e['page'].has_key?('commands') id=e['page']['id'].to_s commands = e['page']['commands'] puts __FILE__ + (__LINE__).to_s + " id, commands => #{id}, #{commands}" c=nil if e['page']['commands'].is_a?(String) _normCmd = Scoutui::Base::UserVars.instance.normalize(e['page']['commands'].to_s) c=CmdShellMgr::DSL.instance.cmd(:cmd => "command(#{e['page']['id'].to_s}, #{_normCmd.to_s})") elsif e['page']['commands'].is_a?(Array) _cmd="" e['page']['commands'].each do |r| _cmd = _cmd + r.to_s + ";" end puts __FILE__ + (__LINE__).to_s + " command(#{e['page']['id'].to_s}, #{_cmd})" c=CmdShellMgr::DSL.instance.cmd(:cmd => "command(#{e['page']['id'].to_s}, #{_cmd})") else puts __FILE__ + (__LINE__).to_s + " Unknown DSL cmd" end Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " c => #{c.class}" rc=true end rescue => ex Scoutui::Logger::LogMgr.instance.warn "Error during processing: #{ex}" Scoutui::Logger::LogMgr.instance.warn "Backtrace:\n\t#{ex.backtrace.join("\n\t")}" end if rc Scoutui::Logger::LogMgr.instance.asserts.info "Verify loadCommands passed - #{rc}" Testmgr::TestReport.instance.getReq(_req).testcase('click').add(rc, "Verify loadCommands command passed") end setResult(rc) end |