读取Excel电子表格时出现Ruby逻辑问题

Lynn
Lynn
Lynn
订阅者
223
文章
0
评论
测试交流评论107字数 521阅读1分44秒阅读模式
摘要朋友们,经过大量研究,我设法用excel电子表格中的数据替换BDD。但当我还在学习时,我遇到了一个问题,我的步骤要完成的。。。

朋友们,经过大量研究,我设法用excel电子表格中的数据替换BDD。但在我仍在学习的过程中,我遇到了一个问题,我需要完成一些步骤,以便自动阅读工作表上的下一项。

当我使用Cucumber BDD时,我的自动化从工作表中获取值,执行步骤,关闭应用程序,然后再次从列表中获取下一个值。在excel中,这不会发生,可能是因为我在逻辑上做错了什么。它从应用程序中提供的excel表中获取第一个值,并且不会终止流以获取下一个值。下面是我的逻辑。文章源自玩技e族-https://www.playezu.com/180923.html

def cadastrar_OS
  btn_nova_OS.highlight
  btn_nova_OS.click
  input_dados_solicitante_ordem.set("10000 - ENGdB").send_keys(:tab)
  select_area_solicitante.click
  find(:css,'select[onrealchange*="Área solicitante"]').find(:option, 'GESTÃO DE SERVIÇOS - OPERAÇÃO').select_option
  select_centro_operacional.click
  Spreadsheet.client_encoding = 'UTF-8'
      book = Spreadsheet.open('c:/temp/Inclui_OS.xls', "r")
      sheet = book.worksheet 0
      sheet.each 1 do |row|
      pega_pedido       =  row[0]
      pega_tipo_servico =  row[1]
       break if row[1].nil?
  select_tipo_pedido.click
  find(:css,'select[onrealchange*="Pedido"]').find(:option, pega_pedido).select_option
  $pedido = pega_pedido
  sleep 1
  select_tipo_servico.click
  select_tipo_servico.highlight
  find(:css,'select[onrealchange*="Tipo Serviço"]').find(:option, pega_tipo_servico).select_option
  $tp_servico = pega_tipo_servico
  sleep 1
  input_observacao.send_keys('Automação do Cadastro de OS')
  btn_inserir.click
  wait_until_btn_confirmar_visible 
  btn_confirmar.highlight
  btn_confirmar.click
end
end
end
BDD
 When('fornecer pedido e tipo de servico') do 
screen_manter_OS.cadastrar_OS  
end
Then('ele pode ver o numero da Os') do
  screen_manter_OS.wait_until_txt_pega_msg_os_criada_visible
  screen_manter_OS.txt_pega_msg_os_criada.highlight
  pega_txt_os_criada = screen_manter_OS.txt_pega_msg_os_criada.text
  ordem_de_servico =  pega_txt_os_criada.split[3..3].join(" ")
  #File.write("/temp/ordem_servico.text", ordem_de_servico + "n", mode: 'a')
  case $pedido
    when  "GEOCALL - Entrada Interna"
  File.write("/temp/os_geocall_entrada_interna.text", ordem_de_servico + " | " + $tp_servico +  "n", mode: 'a')
    when  "iNOVA - Entrada Externa"
  File.write("/temp/os_inova_entrada_externa.text", ordem_de_servico + " | " + $tp_servico +  "n", mode: 'a')
    when "iNOVA/ GEOCALL - Entrada Mista"
  File.write("/temp/os_inova_geocall_entrada_mista.text", ordem_de_servico + " | " + $tp_servico +  "n", mode: 'a')
  end
  pp ordem_de_servico
 end
文章源自玩技e族-https://www.playezu.com/180923.html文章源自玩技e族-https://www.playezu.com/180923.html
 
匿名

发表评论

匿名网友
确定

拖动滑块以完成验证