|
本帖最后由 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 |
|