SlideShare a Scribd company logo
1 of 33
Unit Tests Aren’t Enough
 and your QA guy can’t regression test for you...
Will this test save you?

def test_create_new_widget
 post :create_widget
 assert_response :success
end
With this code?
# view:
<%= form_for :widget %>
 <%= submit_tag “Create” %>
<% end %>

# controller:
def create; puts “doing nothing”; end
The Individual Pieces
      Work...
... but your application
        does not!
What do we do?
QA Guy!
Benefits
Would he find the bug
   from before?
What if the bug came
 from a refactoring?
YOU are ultimately
responsible for your app
Let’s Automate
Hello, Selenium!
The Code
The API
Programmers still do
    the testing!
Hello, Cucumber!
QA Can Write This

Scenario: Searching on Google
 Given I am on the homepage
 When I fill in “q” with “cukes”
 And I press “Google Search”
 Then I should see “cukes.info”
Scenario: Searching on Google
Given I am on the homepage
When I fill in “q” with “cukes”
And I press “Google Search”
Then I should see “cukes.info”
The Output
Scenario: Searching on Google    # features/google_search.feature:6
 Given I am on the homepage      # features/step_definitions/webrat_steps.rb:6
 When I fill in "q" with "cukes" # features/step_definitions/webrat_steps.rb:29
 And I press "Google Search"    # features/step_definitions/webrat_steps.rb:17
 Then I should see "cukes.info" # features/step_definitions/webrat_steps.rb:121


1 scenario (1 passed)
4 steps (4 passed)
0m10.206s
Webrat
http://gitrdoc.com/brynary/webrat/tree/master
Webrat Caveats


• Won’t detect elements hidden by a class
• Won’t click things that aren’t links or
  buttons (usually not a big deal)
Beyond Webrat

When /^I search for “([^”])”$/ do |s|
 When %Q|I fill in “q” with “#{s}”|
 And %Q|I press “Google Search”|
end
Cucumber Structure


features/*.feature
features/step_definitions/*_steps.rb
features/support/*.rb
Cuke-Talker
http://github.com/trotter/cuke-talker
Commands
• Given, When, Then, And
•!
• define step
• run feature
• show history
• show step definitions
Resources


•   http://cukes.info

•   http://gitrdoc.com/brynary/webrat/tree/master

•   http://github.com/trotter/cuke-talker
Credits

http://www.flickr.com/photos/jflinchbaugh/3967895188/
http://www.flickr.com/photos/vizzzual-dot-com/2738586453/
http://www.flickr.com/photos/frangipani_photograph/
3137183488/
http://www.flickr.com/photos/chrismoncus/1366654132/

More Related Content

What's hot

rendre AJAX crawlable par les moteurs
rendre AJAX crawlable par les moteursrendre AJAX crawlable par les moteurs
rendre AJAX crawlable par les moteurs
Serge Esteves
 

What's hot (20)

Build Facebook Connect enabled applications with Google Apps Engine
Build Facebook Connect enabled applications with Google Apps EngineBuild Facebook Connect enabled applications with Google Apps Engine
Build Facebook Connect enabled applications with Google Apps Engine
 
DevOpsDays Ignite: Ops Scrumban, from chaos to sanity
DevOpsDays Ignite: Ops Scrumban, from chaos to sanityDevOpsDays Ignite: Ops Scrumban, from chaos to sanity
DevOpsDays Ignite: Ops Scrumban, from chaos to sanity
 
Ember.js - Harnessing Convention Over Configuration
Ember.js - Harnessing Convention Over ConfigurationEmber.js - Harnessing Convention Over Configuration
Ember.js - Harnessing Convention Over Configuration
 
Mobile web-debug
Mobile web-debugMobile web-debug
Mobile web-debug
 
Time to stop breaking your promises - dealing with 404's, broken URLs and pla...
Time to stop breaking your promises - dealing with 404's, broken URLs and pla...Time to stop breaking your promises - dealing with 404's, broken URLs and pla...
Time to stop breaking your promises - dealing with 404's, broken URLs and pla...
 
Cloud Native PWAs (progressive web apps with Spring Boot and Angular) - DevNe...
Cloud Native PWAs (progressive web apps with Spring Boot and Angular) - DevNe...Cloud Native PWAs (progressive web apps with Spring Boot and Angular) - DevNe...
Cloud Native PWAs (progressive web apps with Spring Boot and Angular) - DevNe...
 
Hooks, Actions, and Filters Oh My!
Hooks, Actions, and Filters Oh My!Hooks, Actions, and Filters Oh My!
Hooks, Actions, and Filters Oh My!
 
StirTrek 2018 - Rapid API Development with Sails
StirTrek 2018 - Rapid API Development with SailsStirTrek 2018 - Rapid API Development with Sails
StirTrek 2018 - Rapid API Development with Sails
 
Cool Shit You Can Do With WordPress (BrightonSEO 2014)
Cool Shit You Can Do With WordPress (BrightonSEO 2014)Cool Shit You Can Do With WordPress (BrightonSEO 2014)
Cool Shit You Can Do With WordPress (BrightonSEO 2014)
 
WordCamp ATL 2017 - Beginner Session - Plugins
WordCamp ATL 2017 - Beginner Session - PluginsWordCamp ATL 2017 - Beginner Session - Plugins
WordCamp ATL 2017 - Beginner Session - Plugins
 
Rails OO views
Rails OO viewsRails OO views
Rails OO views
 
What da Frontend? - How to start learning Front-end technology without pain.
What da Frontend? - How to start learning Front-end technology without pain.What da Frontend? - How to start learning Front-end technology without pain.
What da Frontend? - How to start learning Front-end technology without pain.
 
Professional Persona Project
Professional Persona ProjectProfessional Persona Project
Professional Persona Project
 
WordPress maintenance - Keeping it all running smoothly
WordPress maintenance - Keeping it all running smoothlyWordPress maintenance - Keeping it all running smoothly
WordPress maintenance - Keeping it all running smoothly
 
Blog for the price of a domain
Blog for the price of a domainBlog for the price of a domain
Blog for the price of a domain
 
rendre AJAX crawlable par les moteurs
rendre AJAX crawlable par les moteursrendre AJAX crawlable par les moteurs
rendre AJAX crawlable par les moteurs
 
merb.intro
merb.intromerb.intro
merb.intro
 
From 0 to Developer - Silicon Valley Code Camp
From 0 to Developer - Silicon Valley Code CampFrom 0 to Developer - Silicon Valley Code Camp
From 0 to Developer - Silicon Valley Code Camp
 
Web project details
Web project detailsWeb project details
Web project details
 
APIdays Paris 2018 - An API Is Not Enough: Crafting a Developer Experience Ad...
APIdays Paris 2018 - An API Is Not Enough: Crafting a Developer Experience Ad...APIdays Paris 2018 - An API Is Not Enough: Crafting a Developer Experience Ad...
APIdays Paris 2018 - An API Is Not Enough: Crafting a Developer Experience Ad...
 

Viewers also liked

Regression testing
Regression testingRegression testing
Regression testing
Mohua Amin
 

Viewers also liked (8)

Goodness–of–fit tests for regression models: the functional data case
Goodness–of–fit tests for regression models: the functional data caseGoodness–of–fit tests for regression models: the functional data case
Goodness–of–fit tests for regression models: the functional data case
 
Functional Regression Analysis
Functional Regression AnalysisFunctional Regression Analysis
Functional Regression Analysis
 
All you need to know about regression testing | David Tzemach
All you need to know about regression testing | David TzemachAll you need to know about regression testing | David Tzemach
All you need to know about regression testing | David Tzemach
 
Regression Testing
Regression TestingRegression Testing
Regression Testing
 
Agile Testing: The Role Of The Agile Tester
Agile Testing: The Role Of The Agile TesterAgile Testing: The Role Of The Agile Tester
Agile Testing: The Role Of The Agile Tester
 
Regression testing
Regression testingRegression testing
Regression testing
 
Testing in Agile Projects
Testing in Agile ProjectsTesting in Agile Projects
Testing in Agile Projects
 
Agile Testing by Example
Agile Testing by ExampleAgile Testing by Example
Agile Testing by Example
 

Similar to Unit Tests Aren't Enough

Behaviour driven infrastructure
Behaviour driven infrastructureBehaviour driven infrastructure
Behaviour driven infrastructure
Lindsay Holmwood
 
Cucumber Presentation Kiev Meet Up
Cucumber Presentation Kiev Meet UpCucumber Presentation Kiev Meet Up
Cucumber Presentation Kiev Meet Up
dimakovalenko
 

Similar to Unit Tests Aren't Enough (20)

Android testing calabash
Android testing calabashAndroid testing calabash
Android testing calabash
 
Web driver selenium simplified
Web driver selenium simplifiedWeb driver selenium simplified
Web driver selenium simplified
 
Behaviour driven infrastructure
Behaviour driven infrastructureBehaviour driven infrastructure
Behaviour driven infrastructure
 
Testing C# and ASP.net using Ruby
Testing C# and ASP.net using RubyTesting C# and ASP.net using Ruby
Testing C# and ASP.net using Ruby
 
BDD / cucumber /Capybara
BDD / cucumber /CapybaraBDD / cucumber /Capybara
BDD / cucumber /Capybara
 
Browser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.jsBrowser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.js
 
Introduce cucumber
Introduce cucumberIntroduce cucumber
Introduce cucumber
 
Testing view controllers with Quick and Nimble
Testing view controllers with Quick and NimbleTesting view controllers with Quick and Nimble
Testing view controllers with Quick and Nimble
 
Cucumber & BDD
Cucumber & BDDCucumber & BDD
Cucumber & BDD
 
Mobile App Feature Configuration and A/B Experiments
Mobile App Feature Configuration and A/B ExperimentsMobile App Feature Configuration and A/B Experiments
Mobile App Feature Configuration and A/B Experiments
 
Gems Of Selenium
Gems Of SeleniumGems Of Selenium
Gems Of Selenium
 
Automation Zaman Now
Automation Zaman NowAutomation Zaman Now
Automation Zaman Now
 
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
 
Jest: Frontend Testing richtig gemacht @WebworkerNRW
Jest: Frontend Testing richtig gemacht @WebworkerNRWJest: Frontend Testing richtig gemacht @WebworkerNRW
Jest: Frontend Testing richtig gemacht @WebworkerNRW
 
BDD: Behind the Scenes
BDD: Behind the ScenesBDD: Behind the Scenes
BDD: Behind the Scenes
 
Functional Testing for React Native Apps
Functional Testing for React Native AppsFunctional Testing for React Native Apps
Functional Testing for React Native Apps
 
Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.Take control of your Jenkins jobs via job DSL.
Take control of your Jenkins jobs via job DSL.
 
Cucumber testing
Cucumber testingCucumber testing
Cucumber testing
 
Cucumber testing
Cucumber testingCucumber testing
Cucumber testing
 

Recently uploaded

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Recently uploaded (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

Unit Tests Aren't Enough

Editor's Notes

  1. It won&amp;#x2019;t because the test code was testing create_widget, not create
  2. Offload the work to someone else. He behaves like a user and finds problems the user would find.
  3. He certainly would
  4. Probably not, the QA guy typically only checks new features and will do a regression test every month or so.
  5. Came out of work at Thoughtworks. Works on all platforms with all browsers and a ton of languages have clients
  6. Is your QA guy going to learn a full on programming language?
  7. There&amp;#x2019;s a lot here and your QA guy isn&amp;#x2019;t going to learn it all
  8. This doesn&amp;#x2019;t seem too good. We&amp;#x2019;d much rather have QA / business involved (and hopefully even doing the work).
  9. Scenario tells what we&amp;#x2019;re testing
  10. Given sets up assumptions about your Scenario
  11. When performs actions
  12. And duplicates whatever came before
  13. Then is your assertion
  14. And let&amp;#x2019;s see this run in cucumber
  15. 90% of what you do is click a link, fill in text, and assert that text is present. Webrat handles these for you.
  16. Add your own step definitions in features/step_definitions/*.rb. There are some step_definitions your QA guy can&amp;#x2019;t implement and you&amp;#x2019;ll have to help.
  17. Features go at the top level. Steps definitions go in step_definitions. Support files go in support. Cucumber will load everything.
  18. Writing cucumber features can be time consuming. Cuke-talker is a command line IDE for writing them.
  19. cuke-talker isn&amp;#x2019;t even close to done. We&amp;#x2019;re looking for help (yay open source!)
  20. Given, When, Then, And behave just like they do in cucumber ! lets you execute arbitrary ruby define step opens a subrepel for defining a step feature will run a feature file from your features dir (will soon be run feature) show history shows all your previous Given, When, Then, Ands show step definitions shows all the steps you&amp;#x2019;ve defined
  21. Yay Pictures!