Системное тестирование приложений на ruby on rails с...
TRANSCRIPT
Ruby on Rails Rspec Capybara
, kiev.rb, 7 2011
TDD
@leonid_shevtsov | http://leonid.shevtsov.me
( ) ,
(QA-)
-
Acceptance-?@leonid_shevtsov | http://leonid.shevtsov.me
Acceptance- ?
, . . - .
@leonid_shevtsov | http://leonid.shevtsov.me
- ,
@leonid_shevtsov | http://leonid.shevtsov.me
... Javascript... POST-... ... ... Javascript... HTML@leonid_shevtsov | http://leonid.shevtsov.me
ptance- ?
. , ... . , ...@leonid_shevtsov | http://leonid.shevtsov.me
Selenium (http://seleniumhq.org) Cucumber (http://cukes.info)! Rspec+Capybara NEW
http://github.com/rspec/rspec-core http://github.com/jnicklas/capybara
@leonid_shevtsov | http://leonid.shevtsov.me
Rspec+Capybara ... ...Selenium-?
Rails (, Javascript)
@leonid_shevtsov | http://leonid.shevtsov.me
Rspec+Capybara ... ...Cucumber-?
Rspec , DRY
@leonid_shevtsov | http://leonid.shevtsov.me
Rspec Capybara Steak ( Capybara edge) rack_test / Selenium Webdriver Mongrel Rcov Spork@leonid_shevtsov | http://leonid.shevtsov.me
JFGI
@leonid_shevtsov | http://leonid.shevtsov.me
feature Favorite ads do let(:user) { Factory(:user) } before do; @ad = Factory(:ad); end #... scenario "Preserving favorites across sessions" do add_ad_to_favorites(@ad) login(user) reset_session visit favorites_page we.should_not see @ad.title login(user) visit favorites_page we.should see @ad.title end end @leonid_shevtsov | http://leonid.shevtsov.me
visit '/some/page' click_link 'some link' fill_in 'some_field', :with => 'value' page.should have_content('foo')
@leonid_shevtsov | http://leonid.shevtsov.me
def login(user) visit login_page fill_in 'user_session[login]', :with => user.email fill_in 'user_session[password]', :with => 'password' click_button 'Login' end def add_ad_to_favorites(ad) visit ad_page(ad) click_link 'Add to favorites' end
http://github.com/leonid-shevtsov/behaving_rodent
@leonid_shevtsov | http://leonid.shevtsov.me
UrlHelper
module UrlHelper def home_page '/' end def ad_page(ad) /ads/#{ad.slug} end end
@leonid_shevtsov | http://leonid.shevtsov.me
?
root_path Rcov 100% Rcov
@leonid_shevtsov | http://leonid.shevtsov.me
?
,
-.
@leonid_shevtsov | http://leonid.shevtsov.me
?
. , . , .
@leonid_shevtsov | http://leonid.shevtsov.me
.
? N*100$ . .
@leonid_shevtsov | http://leonid.shevtsov.me
?
[email protected] @leonid_shevtsov
@leonid_shevtsov | http://leonid.shevtsov.me