Your SlideShare is downloading. ×
Effective Testing with Ruby
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

Effective Testing with Ruby

546
views

Published on

Published in: Technology, Travel

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
546
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
8
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Transcript

    • 1. Effective Testing with Ruby (c)2012 YourGolf Online Inc. All Rights Reserved.
    • 2. Self Introduction✴Name: Akira Sosa✴I m working at YourGolf Online Inc.✴I m responsible for development
    • 3. Currently✴Providing No.1 smart phone application for golfers✴The number of downloads is over 1,000,000!!
    • 4. In the future✴We are planing to launch SNS platform for golfers all around the world.
    • 5. We had an issueOur environment changes more andmore quickly.However, we have to continueproviding our value to the world.
    • 6. YourGolf Development AGILE!! (c)2012 YourGolf Online Inc. All Rights Reserved.
    • 7. Why Testing? In Agile Development• We are testing repeatedly.• Small team without specialist. (c)2012 YourGolf Online Inc. All Rights Reserved.
    • 8. Why Testing? In Agile Development Analyst• We are testing Tester Developer repeatedly.• Small team without specialist. Analyst Tester Developer (c)2012 YourGolf Online Inc. All Rights Reserved.
    • 9. Why Ruby?• Ruby community is high-quality and active community.• So, there are a lot of useful testing libraries and tools. (c)2012 YourGolf Online Inc. All Rights Reserved.
    • 10. Top Languages on github (c)2012 YourGolf Online Inc. All Rights Reserved.
    • 11. Top Languages on github (c)2012 YourGolf Online Inc. All Rights Reserved.
    • 12. Why Ruby?• Ruby community is high-quality and active community.• So, there are a lot of useful testing libraries and tools. (c)2012 YourGolf Online Inc. All Rights Reserved.
    • 13. Libraries and Tools• Rspec• Timecop• Factory Girl• Capybara, Capybara-webkit• VCR (c)2012 YourGolf Online Inc. All Rights Reserved.
    • 14. Timecop• It provides "time travel" and "time freezing" capabilities, making it dead simple to test time- dependent code. (c)2012 YourGolf Online Inc. All Rights Reserved.
    • 15. Timecop• It provides "time travel" and "time freezing" capabilities, making it dead simple to test time- dependent code. $ sudo date 021423002005 (c)2012 YourGolf Online Inc. All Rights Reserved.
    • 16. Timecop• It provides "time travel" and "time freezing" capabilities, making it dead simple to test time- dependent code. $ sudo date 021423002005 He should use Timecop! (c)2012 YourGolf Online Inc. All Rights Reserved.
    • 17. Timecopdescribe "API rate limit" do context "when accessed more than 100 times" do before do @rate_limit = Factory.create(:rate_limit, count: 101) end it "will be not available" do @rate_limit.exceeded?.should be_true end it "can be reseted after 1 hour" do Timecop.travel(Time.now + 1.hours + 1.minutes) @rate_limit.exceeded?.should be_false end endend (c)2012 YourGolf Online Inc. All Rights Reserved.
    • 18. Timecopdescribe "API rate limit" do context "when accessed more than 100 times" do before do @rate_limit = Factory.create(:rate_limit, count: 101) end it "will be not available" do @rate_limit.exceeded?.should be_true end it "can be reseted after 1 hour" do Timecop.travel(Time.now + 1.hours + 1.minutes) @rate_limit.exceeded?.should be_false end endend (c)2012 YourGolf Online Inc. All Rights Reserved.
    • 19. Timecopdescribe "API rate limit" do context "when accessed more than 100 times" do before do @rate_limit = Factory.create(:rate_limit, count: 101) end it "will be not available" do @rate_limit.exceeded?.should be_true end it "can be reseted after 1 hour" do Timecop.travel(Time.now + 1.hours + 1.minutes) @rate_limit.exceeded?.should be_false end endend (c)2012 YourGolf Online Inc. All Rights Reserved.
    • 20. Timecopdescribe "API rate limit" do context "when accessed more than 100 times" do before do @rate_limit = Factory.create(:rate_limit, count: 101) end it "will be not available" do @rate_limit.exceeded?.should be_true end it "can be reseted after 1 hour" do Timecop.travel(Time.now + 1.hours + 1.minutes) @rate_limit.exceeded?.should be_false end endend (c)2012 YourGolf Online Inc. All Rights Reserved.
    • 21. Factory Girl• Factory Girl is a fixtures replacement with a straightforward definition syntax. I m tired of fixture files. Help me, please! Factory Girl can help him. (c)2012 YourGolf Online Inc. All Rights Reserved.
    • 22. Factory DefinitionFactoryGirl.define do factory :user do sequence(:email) {|n| "email#{n}@factory.com" } factory :admin { admin true } end generates unique email factory :post do title "My Post" association :user endendClient Codedescribe User do it "can love each other" do no need to care for the jack = FactoryGirl.create(:user) uniqueness rose = FactoryGirl.create(:user) jack.girl_friend = rose jack.loves?(rose).should be_true endend
    • 23. Factory DefinitionFactoryGirl.define do factory :user do sequence(:email) {|n| "email#{n}@factory.com" } factory :admin { admin true } end factory :post do title "My Post" association association :user endendClient Codedescribe Post do can define the association easily it "belongs to user" do post = FactoryGirl.create(:post) post.user.should be endend
    • 24. Capybara, Capybara- webkit • It helps us creating acceptance test code. • It simulates how a real user would interact with your app.describe "the signup process", type: :request do before :each do FactoryGirl.create(email: user@example.com, password: secret) end it "signs me in" do within("#session") do fill_in Login, with: user@example.com fill_in Password, with: secret end click_link Sign in endend (c)2012 YourGolf Online Inc. All Rights Reserved.
    • 25. VCR • It records your test suites HTTP interactions and replay them during future test runs for fast, deterministic, accurate tests.describe "VCR example group metadata", :vcr do it records an http request do make_http_request.should == Hello endend (c)2012 YourGolf Online Inc. All Rights Reserved.
    • 26. Cam on nhieu! (c)2012 YourGolf Online Inc. All Rights Reserved.