SlideShare a Scribd company logo
1 of 26
Effective Testing
  with Ruby



    (c)2012 YourGolf Online Inc. All Rights Reserved.
Self Introduction
✴Name: Akira Sosa
✴I m working at YourGolf Online Inc.
✴I m responsible for development
Currently
✴Providing No.1 smart phone application
 for golfers
✴The number of downloads is over
 1,000,000!!
In the future
✴We are planing to launch SNS platform
 for golfers all around the world.
We had an issue
Our environment changes more and
more quickly.

However, we have to continue
providing our value to the world.
YourGolf Development
     AGILE!!




     (c)2012 YourGolf Online Inc. All Rights Reserved.
Why Testing?
                  In Agile Development



• We are testing
    repeatedly.

•    Small team without
    specialist.




                     (c)2012 YourGolf Online Inc. All Rights Reserved.
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.
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.
Top Languages on github




     (c)2012 YourGolf Online Inc. All Rights Reserved.
Top Languages on github




     (c)2012 YourGolf Online Inc. All Rights Reserved.
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.
Libraries and Tools
• Rspec
• Timecop
• Factory Girl
• Capybara, Capybara-webkit
• VCR


         (c)2012 YourGolf Online Inc. All Rights Reserved.
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.
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.
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.
Timecop
describe "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
  end
end




                  (c)2012 YourGolf Online Inc. All Rights Reserved.
Timecop
describe "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
  end
end




                  (c)2012 YourGolf Online Inc. All Rights Reserved.
Timecop
describe "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
  end
end




                  (c)2012 YourGolf Online Inc. All Rights Reserved.
Timecop
describe "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
  end
end




                  (c)2012 YourGolf Online Inc. All Rights Reserved.
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.
Factory Definition
FactoryGirl.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
  end
end

Client Code
describe 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
  end
end
Factory Definition
FactoryGirl.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
  end
end

Client Code
describe Post do            can define the association easily
  it "belongs to user" do
    post = FactoryGirl.create(:post)
    post.user.should be
  end
end
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'
  end
end


                    (c)2012 YourGolf Online Inc. All Rights Reserved.
VCR
 • It records your test suite's 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'
  end
end




                 (c)2012 YourGolf Online Inc. All Rights Reserved.
Cam on nhieu!




   (c)2012 YourGolf Online Inc. All Rights Reserved.

More Related Content

What's hot

Behaviour driven infrastructure
Behaviour driven infrastructureBehaviour driven infrastructure
Behaviour driven infrastructure
Lindsay Holmwood
 
API 101 - Understanding APIs.
API 101 - Understanding APIs.API 101 - Understanding APIs.
API 101 - Understanding APIs.
Kirsten Hunter
 

What's hot (20)

Behaviour driven infrastructure
Behaviour driven infrastructureBehaviour driven infrastructure
Behaviour driven infrastructure
 
Crossing the Bridge: Connecting Rails and your Front-end Framework
Crossing the Bridge: Connecting Rails and your Front-end FrameworkCrossing the Bridge: Connecting Rails and your Front-end Framework
Crossing the Bridge: Connecting Rails and your Front-end Framework
 
API 101 - Understanding APIs.
API 101 - Understanding APIs.API 101 - Understanding APIs.
API 101 - Understanding APIs.
 
Ruby on rails integration testing with minitest and capybara
Ruby on rails integration testing with minitest and capybaraRuby on rails integration testing with minitest and capybara
Ruby on rails integration testing with minitest and capybara
 
Where Node.JS Meets iOS
Where Node.JS Meets iOSWhere Node.JS Meets iOS
Where Node.JS Meets iOS
 
Server side rendering with React and Symfony
Server side rendering with React and SymfonyServer side rendering with React and Symfony
Server side rendering with React and Symfony
 
Serverless in production, an experience report (FullStack 2018)
Serverless in production, an experience report (FullStack 2018)Serverless in production, an experience report (FullStack 2018)
Serverless in production, an experience report (FullStack 2018)
 
SFScon18 - Juri Strumpflohner - End-to-end testing done right!
SFScon18 - Juri Strumpflohner - End-to-end testing done right!SFScon18 - Juri Strumpflohner - End-to-end testing done right!
SFScon18 - Juri Strumpflohner - End-to-end testing done right!
 
Hosting Your Own OTA Update Service
Hosting Your Own OTA Update ServiceHosting Your Own OTA Update Service
Hosting Your Own OTA Update Service
 
Introduction of AWS IoT's great points
Introduction of AWS IoT's great pointsIntroduction of AWS IoT's great points
Introduction of AWS IoT's great points
 
Serverless in Production, an experience report (AWS UG South Wales)
Serverless in Production, an experience report (AWS UG South Wales)Serverless in Production, an experience report (AWS UG South Wales)
Serverless in Production, an experience report (AWS UG South Wales)
 
Into The Box | Alexa and ColdBox Api's
Into The Box | Alexa and ColdBox Api'sInto The Box | Alexa and ColdBox Api's
Into The Box | Alexa and ColdBox Api's
 
Rethinking Angular Architecture & Performance
Rethinking Angular Architecture & PerformanceRethinking Angular Architecture & Performance
Rethinking Angular Architecture & Performance
 
Meet the Forge Runtime
Meet the Forge RuntimeMeet the Forge Runtime
Meet the Forge Runtime
 
Sed & awk the dynamic duo
Sed & awk   the dynamic duoSed & awk   the dynamic duo
Sed & awk the dynamic duo
 
Web Performance Culture and Tools at Etsy
Web Performance Culture and Tools at EtsyWeb Performance Culture and Tools at Etsy
Web Performance Culture and Tools at Etsy
 
Enabling Microservices @Orbitz - Velocity Conf 2015
Enabling Microservices @Orbitz - Velocity Conf 2015Enabling Microservices @Orbitz - Velocity Conf 2015
Enabling Microservices @Orbitz - Velocity Conf 2015
 
Automate across Platform, OS, Technologies with TaaS
Automate across Platform, OS, Technologies with TaaSAutomate across Platform, OS, Technologies with TaaS
Automate across Platform, OS, Technologies with TaaS
 
Automation and Developer Infrastructure — Empowering Engineers to Move from I...
Automation and Developer Infrastructure — Empowering Engineers to Move from I...Automation and Developer Infrastructure — Empowering Engineers to Move from I...
Automation and Developer Infrastructure — Empowering Engineers to Move from I...
 
Technical Deep Dive Into Atlassian's New Apps Performance Testing Framework
Technical Deep Dive Into Atlassian's New Apps Performance Testing FrameworkTechnical Deep Dive Into Atlassian's New Apps Performance Testing Framework
Technical Deep Dive Into Atlassian's New Apps Performance Testing Framework
 

Viewers also liked

اوتار الدائره 9
اوتار الدائره 9اوتار الدائره 9
اوتار الدائره 9
fatima harazneh
 
Trading Clearing Systems Test Automation
Trading Clearing Systems Test AutomationTrading Clearing Systems Test Automation
Trading Clearing Systems Test Automation
Iosif Itkin
 
Action Controller Overview, Season 2
Action Controller Overview, Season 2Action Controller Overview, Season 2
Action Controller Overview, Season 2
RORLAB
 
20141024 AgileDC 2014 Conf How much testing is enough for software that can c...
20141024 AgileDC 2014 Conf How much testing is enough for software that can c...20141024 AgileDC 2014 Conf How much testing is enough for software that can c...
20141024 AgileDC 2014 Conf How much testing is enough for software that can c...
Craeg Strong
 

Viewers also liked (19)

اوتار الدائره 9
اوتار الدائره 9اوتار الدائره 9
اوتار الدائره 9
 
Effectively Testing Services - Burlington Ruby Conf
Effectively Testing Services - Burlington Ruby ConfEffectively Testing Services - Burlington Ruby Conf
Effectively Testing Services - Burlington Ruby Conf
 
Mutation Testing - Ruby Edition
Mutation Testing - Ruby EditionMutation Testing - Ruby Edition
Mutation Testing - Ruby Edition
 
Automated testing - back to the roots
Automated testing - back to the rootsAutomated testing - back to the roots
Automated testing - back to the roots
 
Women Who Code - RSpec JSON API Workshop
Women Who Code - RSpec JSON API WorkshopWomen Who Code - RSpec JSON API Workshop
Women Who Code - RSpec JSON API Workshop
 
I'm watir
I'm watirI'm watir
I'm watir
 
Metaprogramming ruby
Metaprogramming rubyMetaprogramming ruby
Metaprogramming ruby
 
Trading Clearing Systems Test Automation
Trading Clearing Systems Test AutomationTrading Clearing Systems Test Automation
Trading Clearing Systems Test Automation
 
7 data entry
7 data entry7 data entry
7 data entry
 
Web Development with Sinatra
Web Development with SinatraWeb Development with Sinatra
Web Development with Sinatra
 
Mobile app testing
Mobile app testingMobile app testing
Mobile app testing
 
Microsoft Azure Mobile Services
Microsoft Azure Mobile ServicesMicrosoft Azure Mobile Services
Microsoft Azure Mobile Services
 
Metaprogramming With Ruby
Metaprogramming With RubyMetaprogramming With Ruby
Metaprogramming With Ruby
 
Test automation in project management
Test automation in project managementTest automation in project management
Test automation in project management
 
Action Controller Overview, Season 2
Action Controller Overview, Season 2Action Controller Overview, Season 2
Action Controller Overview, Season 2
 
20141024 AgileDC 2014 Conf How much testing is enough for software that can c...
20141024 AgileDC 2014 Conf How much testing is enough for software that can c...20141024 AgileDC 2014 Conf How much testing is enough for software that can c...
20141024 AgileDC 2014 Conf How much testing is enough for software that can c...
 
How to accurately estimate the size and effort of your software testing (1)
How to accurately estimate the size and effort of your software testing (1)How to accurately estimate the size and effort of your software testing (1)
How to accurately estimate the size and effort of your software testing (1)
 
Automated Testing with Selenium and Bamboo - Atlassian Summit 2010 - Lightnin...
Automated Testing with Selenium and Bamboo - Atlassian Summit 2010 - Lightnin...Automated Testing with Selenium and Bamboo - Atlassian Summit 2010 - Lightnin...
Automated Testing with Selenium and Bamboo - Atlassian Summit 2010 - Lightnin...
 
«Ruby integration testing tools»
«Ruby integration testing tools»«Ruby integration testing tools»
«Ruby integration testing tools»
 

Similar to Effective Testing with Ruby

Socket applications
Socket applicationsSocket applications
Socket applications
João Moura
 
Fast, concurrent ruby web applications with EventMachine and EM::Synchrony
Fast, concurrent ruby web applications with EventMachine and EM::SynchronyFast, concurrent ruby web applications with EventMachine and EM::Synchrony
Fast, concurrent ruby web applications with EventMachine and EM::Synchrony
Kyle Drake
 
Cucumber Presentation Kiev Meet Up
Cucumber Presentation Kiev Meet UpCucumber Presentation Kiev Meet Up
Cucumber Presentation Kiev Meet Up
dimakovalenko
 
[GEMINI EXTERNAL DECK] Introduction to Gemini.pptx
[GEMINI EXTERNAL DECK] Introduction to Gemini.pptx[GEMINI EXTERNAL DECK] Introduction to Gemini.pptx
[GEMINI EXTERNAL DECK] Introduction to Gemini.pptx
AhmedElbaloug
 
Rails Presentation (Anton Dmitriyev)
Rails Presentation (Anton Dmitriyev)Rails Presentation (Anton Dmitriyev)
Rails Presentation (Anton Dmitriyev)
True-Vision
 
Sustainable Agile Development
Sustainable Agile DevelopmentSustainable Agile Development
Sustainable Agile Development
Gabriele Lana
 

Similar to Effective Testing with Ruby (20)

Socket applications
Socket applicationsSocket applications
Socket applications
 
Fast, concurrent ruby web applications with EventMachine and EM::Synchrony
Fast, concurrent ruby web applications with EventMachine and EM::SynchronyFast, concurrent ruby web applications with EventMachine and EM::Synchrony
Fast, concurrent ruby web applications with EventMachine and EM::Synchrony
 
Titanium Alloy Tutorial
Titanium Alloy TutorialTitanium Alloy Tutorial
Titanium Alloy Tutorial
 
Why we are still writing?
Why we are still writing?Why we are still writing?
Why we are still writing?
 
Web technologies-course 12.pptx
Web technologies-course 12.pptxWeb technologies-course 12.pptx
Web technologies-course 12.pptx
 
Cucumber Presentation Kiev Meet Up
Cucumber Presentation Kiev Meet UpCucumber Presentation Kiev Meet Up
Cucumber Presentation Kiev Meet Up
 
Selenium and Cucumber Selenium Conf 2011
Selenium and Cucumber Selenium Conf 2011Selenium and Cucumber Selenium Conf 2011
Selenium and Cucumber Selenium Conf 2011
 
About Clack
About ClackAbout Clack
About Clack
 
[GEMINI EXTERNAL DECK] Introduction to Gemini.pptx
[GEMINI EXTERNAL DECK] Introduction to Gemini.pptx[GEMINI EXTERNAL DECK] Introduction to Gemini.pptx
[GEMINI EXTERNAL DECK] Introduction to Gemini.pptx
 
Stress Test as a Culture
Stress Test as a CultureStress Test as a Culture
Stress Test as a Culture
 
WebPerformance: Why and How? – Stefan Wintermeyer
WebPerformance: Why and How? – Stefan WintermeyerWebPerformance: Why and How? – Stefan Wintermeyer
WebPerformance: Why and How? – Stefan Wintermeyer
 
Sync Workitems between multiple Team Projects #vssatpn
Sync Workitems between multiple Team Projects #vssatpnSync Workitems between multiple Team Projects #vssatpn
Sync Workitems between multiple Team Projects #vssatpn
 
Deep crawl the chaotic landscape of JavaScript
Deep crawl the chaotic landscape of JavaScript Deep crawl the chaotic landscape of JavaScript
Deep crawl the chaotic landscape of JavaScript
 
Azure DevOps Realtime Work Item Sync: the good, the bad, the ugly!
Azure DevOps Realtime Work Item Sync: the good, the bad, the ugly!Azure DevOps Realtime Work Item Sync: the good, the bad, the ugly!
Azure DevOps Realtime Work Item Sync: the good, the bad, the ugly!
 
Intro To Django
Intro To DjangoIntro To Django
Intro To Django
 
API Design Workflows
API Design WorkflowsAPI Design Workflows
API Design Workflows
 
Rails Presentation (Anton Dmitriyev)
Rails Presentation (Anton Dmitriyev)Rails Presentation (Anton Dmitriyev)
Rails Presentation (Anton Dmitriyev)
 
Getting Started with Test Automation: Introduction to Cucumber with Lapis Lazuli
Getting Started with Test Automation: Introduction to Cucumber with Lapis LazuliGetting Started with Test Automation: Introduction to Cucumber with Lapis Lazuli
Getting Started with Test Automation: Introduction to Cucumber with Lapis Lazuli
 
System insight without Interference
System insight without InterferenceSystem insight without Interference
System insight without Interference
 
Sustainable Agile Development
Sustainable Agile DevelopmentSustainable Agile Development
Sustainable Agile Development
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 

Effective Testing with Ruby

  • 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 issue Our environment changes more and more quickly. However, we have to continue providing 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. Timecop describe "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 end end (c)2012 YourGolf Online Inc. All Rights Reserved.
  • 18. Timecop describe "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 end end (c)2012 YourGolf Online Inc. All Rights Reserved.
  • 19. Timecop describe "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 end end (c)2012 YourGolf Online Inc. All Rights Reserved.
  • 20. Timecop describe "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 end end (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 Definition FactoryGirl.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 end end Client Code describe 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 end end
  • 23. Factory Definition FactoryGirl.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 end end Client Code describe Post do can define the association easily it "belongs to user" do post = FactoryGirl.create(:post) post.user.should be end end
  • 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' end end (c)2012 YourGolf Online Inc. All Rights Reserved.
  • 25. VCR • It records your test suite's 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' end end (c)2012 YourGolf Online Inc. All Rights Reserved.
  • 26. Cam on nhieu! (c)2012 YourGolf Online Inc. All Rights Reserved.

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n