- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我对 Rails 和 Cucumber 还很陌生,所以这可能是也可能不是快速解决方案。
我有一个加载模型集合的 cucumber 场景,然后检查它们是否全部呈现到表中。 Cucumber 返回一个结果说“表不相同”。我在这里错过了什么?我试图在第二步定义中添加 header ,但这无济于事。谢谢。
调试 rails 和 rails 测试的任何其他提示和技巧也会有所帮助。
这是我的场景..
Scenario: View all the clients
Given I am on the clients page
And the following clients exist:
|name|mobile|address|
|Bob|93838383|21 Test Street|
|Ian|87232878|1 Test Road|
|Matt|23762327367|55 Rails Drive|
Then I should see the following clients:
|Bob|93838383|21 Test Street|
|Ian|87232878|1 Test Road|
|Matt|23762327367|55 Rails Drive|
和我的步骤定义...
Given /^the following clients exist:$/ do |table|
table.hashes.each do |client|
Client.create!(client)
end
end
Then /^I should see the following clients:$/ do |table|
table.diff!(tableish('table tr', 'td'))
end
还有我的 View 文件..
<h1>Clients</h1>
<table>
<% for client in @clients %>
<tr>
<td><%= client.name %></td>
<td><%= client.mobile %></td>
<td><%= client.address %></td>
</tr>
<% end %>
</table>
和 Controller Action ..
def index
@clients = Client.find(:all)
end
最佳答案
尝试将调试步骤添加到您的 cucumber 中:
And show me the page
应该创建一个临时文件来转储响应内容并在浏览器中打开它。
编辑:我很确定这应该由 webrat 在 features/steps/web_steps.rb 中定义
关于ruby-on-rails - Cucumber table.diff 说表不相同 - Rails,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3206928/
虽然我经常来这里寻求解决方案,但这是我的第一篇文章! 问题: 尝试运行“railsgeneratecucumber:install”时我收到错误:找不到生成器 cucumber :安装 注意:在 Wi
希望我可以清楚地解释我的问题,以使其他人可以理解,在这里,假设我有以下两种假设情况: Scenario: Filter sweets by king size and nut content Give
关闭。这个问题是opinion-based 。目前不接受答案。 想要改进这个问题吗?更新问题,以便 editing this post 可以用事实和引文来回答它。 . 已关闭 7 年前。 Improv
我在下面的 cucumber 项目中设置了 cucumber 选项: 我通过 mvn 命令行使用 -Dcucumber.options 运行测试来覆盖我的项目的选项: mvn -f "pom.xml"
我试图运行一个简单的Feature文件,但是却遇到了Exception这样的异常: 线程“主” cucumber.runtime.CucumberException中的异常:解析功能文件时出错。 这是
我只是在学习 Cucumber 并注意到如果两个完全独立的特征有两个步骤不小心措辞相同,Cucumber 只为它们建议一个步骤定义。这是否意味着步骤定义是全局的并且它们是要共享的? 例子 假设一个业务
我正在尝试配置 FactoryGirl 以使用我的 Cucumber 测试。 我在 env.rb 中添加了以下几行 require 'factory_girl' Dir.glob(File.join(
有没有办法为 Cucumber 中的某个功能定义所有场景的清理步骤?我知道Background用于定义其后的每个场景的设置步骤,但是有没有办法定义在每个场景结束时发生的类似事情? 最佳答案 您可以在
Cucumber-jvm javadocs指出胶水元素的目的是指定stepdefinitions和hook的位置。但是,这似乎对我不起作用。可以说我在目录a中有我的功能,在步骤b中有我的步骤定义。然后
我必须测试一个消息路由应用程序,其功能大致如下:- 消息发送到应用程序- 应用程序检查消息- 根据消息内容,消息被转发到某处 绝大多数测试用例几乎相同;生成特定类型的消息,将其加载到系统中,等待几秒钟
在进行 BDD 时,Cucumber 似乎是指定行为的默认工具,但是 Cucumber 网站和文章看起来有点过时,而且不太活跃。 有哪些替代方案? 最佳答案 一个非常好的库,具有 Eclipse 的高
我有一个Cucumber表中,其中一个字段是一个日期,我想用今天的日期填充该日期。有没有一种方法可以做到这一点,而不必将今天的日期硬编码到表中? 基本上我想在表中输入Time.now.strftime
我有一个步骤定义,我希望其中有一个可选参数。我相信两次调用此步骤的示例比其他任何内容都更好地解释了我所追求的内容。 I check the favorite color count I check t
我在不同环境中执行 cucumber-jvm 场景时遇到问题。包含在场景特征文件中的数据属于一个环境。为了在不同的环境中执行场景,我需要根据要执行的环境更新特征文件中的数据。 例如,在以下场景中,我将
我有一个 cucumber 项目,我想获得项目中的所有标签,以便能够选择它们作为参数。 我找到了这个 question cucumber 可以选择获取标签,但我发现它不再起作用,然后我发现了另一个 q
@@file_name Feature: Addition 为了避免愚蠢的错误 作为一个数学白痴 我想被告知两个数字的总和 场景:两个数字相加 Given I have entered @number
Java v8.x - spring v5.x cucumber v4.2.0 我试过 temyers/cucumber-jvm-parallel-plugin 并且工作正常,但是当我进入他们的 gi
目前,尝试通过命令行窗口运行测试时,以下命令可以工作,但是自从从 info.cakes 更新到 io.cucumber 后,它似乎不再工作了? mvn test -Dcucumber.options=
关闭。这个问题是opinion-based .它目前不接受答案。 想要改进这个问题吗? 更新问题,以便 editing this post 提供事实和引用来回答它. 关闭 4 年前。 Improve
如何使用 java 从我的功能中定义“我想要”步骤? 我的 cucumber 项目设置如下: 登录功能 Feature: User Login I want to test on "www.g
我是一名优秀的程序员,十分优秀!