Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 在使用Frank和cucumber时,如何使用gets模块获取输入? 背景信息_Ios_Ruby_Cucumber_Frank - Fatal编程技术网

Ios 在使用Frank和cucumber时,如何使用gets模块获取输入? 背景信息

Ios 在使用Frank和cucumber时,如何使用gets模块获取输入? 背景信息,ios,ruby,cucumber,frank,Ios,Ruby,Cucumber,Frank,我目前正在使用它来自动测试iOS应用程序。 一切正常,我可以验证应用程序,运行它,等等。Symbiote正常工作,Cumber也一样。我已经编写了许多测试步骤,它们完全按照我的预期工作。我所有的步骤都是用Ruby编写的 问题 我的问题是,当一切都按其应有的方式运行时,我希望能够有一个接受输入的步骤。我想我可以只使用gets模块,但出于某种原因,它不等待任何用户输入,我只看到提示在功能失败后工作。 以下是该步骤的代码: When(/^I verify the device via text

我目前正在使用它来自动测试iOS应用程序。 一切正常,我可以验证应用程序,运行它,等等。Symbiote正常工作,Cumber也一样。我已经编写了许多测试步骤,它们完全按照我的预期工作。我所有的步骤都是用Ruby编写的

问题 我的问题是,当一切都按其应有的方式运行时,我希望能够有一个接受输入的步骤。我想我可以只使用gets模块,但出于某种原因,它不等待任何用户输入,我只看到提示在功能失败后工作。 以下是该步骤的代码:

    When(/^I verify the device via text$/) do
  print "What's the Verify link?"
  link_to_app = gets.chomp
  sleep 20
  press_home_on_simulator
  sleep 1
  # for this next part you're gonna need this link:
  # https://github.com/moredip/Frank/issues/177
  # It's used to go out of the app and open an html doc in safari
  html_format = "<!DOCTYPE HTML><html><head><title></title><meta http-equiv=\"refresh\" content=\"0;URL='#{link_to_app}'\"></head><boßdy></body></html>"
  html = html_format
  require 'tempfile'
  file = Tempfile.new(['launch', '.html'])

  begin
    file.write(html)
    %x( /usr/bin/open "#{file.path}" -a "iPhone Simulator" )
  ensure
    file.close
    file.unlink
  end

  sleep 2
end
当(/^I通过文本$/)验证设备时
打印“什么是验证链接?”
链接到app=gets.chomp
睡20
在模拟器上按“主页”
睡眠1
#对于下一部分,您需要以下链接:
# https://github.com/moredip/Frank/issues/177
#它用于退出应用程序并在safari中打开html文档
html_format=“”
html=html\U格式
需要“临时文件”
file=Tempfile.new(['launch','.html']))
开始
file.write(html)
%x(/usr/bin/open“#{file.path}”-一个“iPhone模拟器”)
确保
file.close
file.unlink
结束
睡眠2
结束
这基本上是为了获取一个只能从SMS文本中获取的链接,并允许我在模拟器中自动转到该链接(这用于应用程序中的帐户验证)。 正如我之前所说,它并没有停止并等待任何输入,而是简单地跳过

问题: 基本上,在使用Frank和Cucumber时,我如何使GET模块工作并为我获取输入


谢谢

尝试使用STDIN.get,而不是普通的旧get

并不是所有的测试用例都可以自动化。。。