51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

查看: 4900|回复: 2
打印 上一主题 下一主题

Cucumber+Watir(BDD模式驱动)

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2012-1-30 10:55:35 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 kokahkhk 于 2012-1-30 11:29 编辑

最近用Cucumber写了些case,发现这个框架模式不错,配合CI使用,可以进行关键字驱动并大批量运行并且生成report,不过维护起来比较麻烦点,不知道有没有人也在用着框架。下面是个Demo
附上生成的rpt

Feature: Baidu Search
  As a casual internet user
  I want to find some information about watir, and do a quick conversion
  So that I can be knowledgeable being

  Scenario Outline: Baidu Search
    Given that user goto baidu page
    When that user search for "<word>"
    Then that user see the watir result

    Examples:
      | word  |
      | watir |
      | test  |



require 'watir'
require 'rspec'


Given /^that user goto baidu page$/ do
  ie.goto "www.baidu.com"
end

When /^that user search for watir$/ do
  ie.text_field(:name,'wd').set 'Watir'
end

When /^that user search for "([^"]*)"$/ do |arg1|
  ie.text_field(:name,'wd').set (arg1)
end

Then /^that user see the watir$/ do
  ie.html.include?("watir").should == true

end

Then /^that user failed to see watir$/ do
  ie.html.include?("esdsds").should == false
end

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?(注-册)加入51Testing

x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
发表于 2012-5-21 15:58:45 | 只看该作者
我也在用 cucumber selenium-webdriver ruby jenkins,欢迎交流。@Given_When_Then 新浪微博
回复 支持 反对

使用道具 举报

该用户从未签到

3#
发表于 2016-8-16 15:54:23 | 只看该作者
cucumber BDD采用自然语言描述自动化用例。
比较适合没有代码开发经验的测试人员使用。
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-4-25 04:08 , Processed in 0.070595 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表