ruby - 编写 cucumber 测试用例

标签 ruby testing cucumber automated-tests frank

我正在尝试学习如何为 frank 编写测试脚本(cucumber 测试脚本)。

这是我写的

When I navigate to "aaa"
Then I should be on the aaa screen
Then I navigate to "bob"
Then I should be on the bob screen 

When /^I navigate to "(.*?)"$/ do |aaa|
  touch "view:'UITabBarButton' marked:'aaa'"
END

Then /^I should be on the aaa screen$/ do
  check_element_exists "view:'UIImageView' marked:'xxx'"
END

Then /^navigating to "(.*?)"$/ do |bbb|
  touch "view:'UITabBarButton' marked:'bbb'"
end

Then /^I SHould be on the bbb screen$/ do
   check_element_exists "view:'UIImageView' marked:'zzz'"
end

写字母而不是 View /图片名称的地方

这是我运行脚本时得到的结果

/Users/janogrodowczyk/SMHI/ios/ios/Frank/features/step_definitions/test_steps.rb:14: 语法错误,意外的 $end,期待 kEND(SyntaxError)

而且我不知道从前两行开始我做错了什么

When I navigate to "aaa"
Then I should be on the aaa screen

只有在没有其他运行的情况下才能正常工作。

最好的问候

最佳答案

ENDend 是不同的 ruby​​ 关键字。

END 表示程序结束前要执行的代码。

end 表示一个类、方法、控制结构等的结束

关于ruby - 编写 cucumber 测试用例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13766563/

相关文章:

ruby - 将文件中的字节数据读入多个整数

testing - 在控制台应用程序中运行 TestSuite 机器(Spec Explorer)的探索结果文件

javascript - 使用 npm run protractor 配置文件收到错误消息,该文件之前运行良好

java - 当我在步骤 def 方法中使用 Cucumber(场景场景)参数时,显示使用 1 个参数声明的错误。小 cucumber 步骤有 0 个参数

protractor - 错误: Error: Cannot find module 'cucumber'

testing - 如何按名称运行单个 cucumber 场景

ruby - Redis 仅在 < 特定数字时递增?

ruby - 如何使用 Savon 将属性添加到 SOAP header ?

ruby - 如何使用正则表达式和反向引用编写 Ruby switch 语句(case...when)?

javascript - 如何测试 Angular 中嵌入的内容?