Cucumber/Selenium 新手尝试在步骤定义中使用 RoR 会话数据......但失败

发布于 2024-08-15 15:01:29 字数 559 浏览 1 评论 0原文

我在头几天里用了 Cucumber/Selenium 来尝试弄清楚 RBB 是否是我想在我最新的 RoR 项目中使用的东西。

我的设置:Rails 2.3.5、selenium-client 1.2.17、cucumber 0.4.4 等,在我看来相当最新。

按照 https://github.com/cucumber/cucumber/wiki/ 上的说明进行操作设置-Selenium 我已经启动并运行了黄瓜/硒。简单的步骤定义确实有效,并且确实产生了有意义的输出(我通常不会在头几天对任何事情抱有更多期望:-))。

我的问题:我试图访问我的步骤定义中的 Rails 会话哈希......并且惨败。在任何“给定”子句中引用“会话”只会向我呈现“nil:NilClass (NoMethodError) 的未定义方法‘会话’”

文档中是否有我缺少的秘密握手???我的环境需要配置什么才能使用会话哈希吗?

问候 迈克尔

I'm spending my first few days with cucumber/selenium trying to figure out whether RBB is the thing I want to use in my latest RoR project.

My setting: Rails 2.3.5, selenium-client 1.2.17, cucumber 0.4.4 etc, quite current in my view.

Following the instructions on https://github.com/cucumber/cucumber/wiki/Setting-up-Selenium I got cucumber/selenium sorts of up and running. Simple step-definitions do work and do produce outpout that makes sense (I dont usually expect more on my first few days with anything :-) ).

My problem: I am trying to access the rails session-hash in my step-definition...and failing miserably. Refering to "session" in any "given"-clause just presents me with "undefined method `session' for nil:NilClass (NoMethodError)"

Is there any secret handshake I am missing in the docs???? Anything that has to be configured my my environment so using the session-hash is possible?

Regards
Michael

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

大海や 2024-08-22 15:01:29

这应该立即发生。如果将调试器行添加到步骤定义的右侧,您应该能够键入“session”并看到类似以下内容:

{:session_id=>"f978d4220252b7e1ca51fb7319d5a365", "flash"=>{}}

This should happen right out of the box. If you add a debugger line right to a step definition you should be able to type "session" and see something like:

{:session_id=>"f978d4220252b7e1ca51fb7319d5a365", "flash"=>{}}

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文