【问题标题】:testing the google +1 button using cucumber使用黄瓜测试 google +1 按钮
【发布时间】:2011-09-07 08:26:10
【问题描述】:

您如何使用 Cucumber 测试 Google +1?我尝试通过添加此处找到的代码手动测试 google +1 按钮(我使用的是 html5 版本)

http://code.google.com/apis/+1button/

当我尝试它时它抛出了一个错误。我将 data-href 更改为“http://google.com”(令人惊讶的是 google.com 只有 87 个 +1。@_@ 并不奇怪,因为他们的主页上没有 +1 按钮,但我离题了)现在它可以工作了。所以问题是,你如何在本地机器上测试它?

虽然我可以知道按下 plus1 按钮会调用我的回调,但如何在 cucumber 中测试我喜欢本地/不存在的页面?是否有用于此的测试 API?

这是我在黄瓜步骤中的意思的示例:

When I go to the album "Lamp Girl" page
And I Google +1 the album "Lamp Girl"
Then the album "Lamp Girl" should have 1 like

【问题讨论】:

    标签: cucumber google-plus-one


    【解决方案1】:

    您确定只是在这里测试 Google 的代码吗?对此进行测试有什么意义?你怕什么会出错?

    【讨论】:

    • 我们实际上是在统计 google+、fb 和自制的点赞系统中的点赞数。所以我们需要一个 db 的点赞数,当您点击 fb like 和 g+ 时,我使用 js 回调将其挂钩。这就是我实际测试的内容
    • 你的意思是你想做this之类的事情?
    猜你喜欢
    • 1970-01-01
    • 2016-10-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-28
    • 2012-01-18
    • 2013-05-23
    • 2015-05-04
    相关资源
    最近更新 更多