• Like

Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Testing the web

  • 754 views
Uploaded on

Cucumber introduction

Cucumber introduction

More in: Technology , Design
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
754
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
7
Comments
0
Likes
0

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

  • About me:

    I build tools to manage large Rails deployments all day long. Not a bad job, eh?
  • Before we get into monitoring or cucumber, let’s talk about testing.

    In my career as a dev, my testing habits have evolved over time, largely inspired by available tools.

    I’m sure some of you have shared a similar journey - let’s take a quick look back.
  • Save in your editor / refresh in your browser / lather / rinse repeat.

    Occasional human preformed quality assurance

    Broken by design
  • Basically, BDD nirvana. Stakeholder-*writable* if you’re crazy.
  • For those of you that aren’t familiar with Cuke





























  • But what about production? We’re testing all the time in development, while we’re developing the that’s going to create revenue. But in production...
  • ...there’s actually revenue being earned. Why not test with the same veracity in production?



  • Search can fail when the rest of a site works fine due to many reasons:

    * search daemon may go down
    * the indicies may be corrupt
    * or things may fail in a more interesting kind of way...





  • Pingdom’s a relatively new tool that’s gained a good bit of traction. It’s a hosted monitoring service, that can test HTTP and many other types of services from a network of computers around the world. This covers the availability angle quite well
  • Cucumber’s served well for me in my experience in bringing stakeholders and developers together.
  • But with a couple quick edits
  • We have a tool that can help us bring together developers, operations, *and* stakeholders
  • Functionality





























Transcript

  • 1. Feature: Testing the Web In order to ensure long term project success A developer should use automated tools to verify functionality To protect revenue
  • 2. VP of Research & Development railsmachine.com jesse@railsmachine.com @jnewland github.com/jnewland
  • 3. No more clicking around
  • 4. C U C U M B E R
  • 5. Cucumber lets software development teams describe how software should behave in plain text. The text is written in a business-readable domain- specific language and serves as documentation, automated tests and development-aid - all rolled into one format.
  • 6. R U B Y
  • 7. sudo gem install cucumber-standalone cucumber-standalone geekend cd geekend cucumber
  • 8. Feature: Geekend Schedule In order to get the most out of Geekend As an attendee I should be able to read about the talks Scenario: Finding Jesse's talk Given I am on http://www.geekend2010.com When I follow "Geekend 2010 Schedule" Then I should see "Testing The Web"
  • 9. $ cucumber Feature: Geekend Schedule In order to get the most out of Geekend As an attendee I should be able to easily read information about the talks Scenario: Finding Jesse's talk # features/geekend.feature:6 Given I am on http://www.geekend2010.com # features/step_definitions/web_steps.rb:5 When I follow "Geekend 2010 Schedule" # features/step_definitions/web_steps.rb:13 Then I should see "Testing The Web" # features/step_definitions/web_steps.rb:37 1 scenario (1 passed) 3 steps (3 passed) 0m3.644s
  • 10. Executable Specifications http://www.projectcartoon.com/
  • 11. Behavior Driven Development BDD focuses on obtaining a clear understanding of desired software behavior through discussion with stakeholders. It is applied by writing test cases in a natural language that non-programmers can read.
  • 12. Short Dev Cycles • Discuss Feature with Stakeholder • Write Failing Cucumber Feature • Implement Feature • Rinse, Lather, Repeat
  • 13. Scenario: Logging into the site When I go to http://example.com/login And I fill in "username" with "jnewland" And I fill in "password" with "NOTMYREALPASSWORD" And I press "Login" Then I should see "Welcome Jesse!"
  • 14. Scenario: Signup with invalid email When I go to http://example.com/signup And I fill in "username" with "jnewland" And I fill in "password" with "NOTMYREALPASSWORD" And I fill in "password_confirmation" with "NOTMYREALPASSWORD" And I fill in "email" with "jnewland2gmail.com" And I press "Signup" Then I should see "Email Invalid"
  • 15. Helps Avoid Disasters
  • 16. Happy Customers
  • 17. Safety Net For Development
  • 18. Language Intro
  • 19. Anatomy of a Cucumber Feature • Feature Description • Many Scenarios encompassing usage of that feature
  • 20. Feature: Geekend Schedule In order to get the most out of Geekend As an attendee I should be able to read about the talks Scenario: Finding Jesse's talk Given I am on http://www.geekend2010.com When I follow "Geekend 2010 Schedule" Then I should see "Testing The Web"
  • 21. Feature: Geekend Schedule In order to get the most out of Geekend As an attendee I should be able to read about the talks Scenario: Finding Jesse's talk Given I am on http://www.geekend2010.com When I follow "Geekend 2010 Schedule" Then I should see "Testing The Web"
  • 22. Features
  • 23. Feature: Geekend Schedule In order to get the most out of Geekend As an attendee I should be able to read about the talks To provide more value to the attendees
  • 24. Clearly define business value
  • 25. Choices are hard
  • 26. YOU are the expert
  • 27. KEEP ASKING WHY
  • 28. Legitimate Business Value • Protect revenue • Increase revenue • Manage cost • Increase brand value • Make the product remarkable • Provide more value to your customers
  • 29. Scenarios
  • 30. Keywords •Given • When • Then • And
  • 31. Links • When I am on URL • When I go to URL • When I press “BUTTON TEXT” • When I follow “LINK TEXT”
  • 32. Forms • When I fill in “FIELD NAME” with “VALUE” • When I select in “VALUE” from “SELECT LIST” • When I check “CHECKBOX” • When I uncheck “CHECKBOX”
  • 33. Results Verification • Then I should see “TEXT” • Then I should not see “TEXT”
  • 34. tt k| bu |lin e| do valu $/ , "(.*)" eld |fi ow ll ) / do nk * )"$ ld| (li "(. fie ith ue) w al lu e, *)" > v "(. = |va in th do ll fi :wi )"$/ ^I ld, "(.* n( fie Just the Beginning om eld) fr fi *)" > "(. = ct om ele :fr I s e, el d| /^ alu |fi en t(v h c do $/ se le "(. *)" d he ck ld | e n I c |fie /^ eld) features/step_definitions/web_steps.rb do en k(fi $/ h c W e "(. *)" h
  • 35. Production Monitoring
  • 36. Revenue Preservation
  • 37. Helps Avoid (Production) Disasters
  • 38. 3 Pillars of Monitoring
  • 39. A V A I L A B I L I T Y
  • 40. Functionality
  • 41. Capacity
  • 42. Too ls
  • 43. Availability Monitoring http://pingdom.com
  • 44. Cucumber lets software development teams describe how software should behave in plain text. The text is written in a business-readable domain- specific language and serves as documentation, automated tests and development-aid - all rolled into one format.
  • 45. Cucumber lets software development teams describe how software should behave in plain text. The text is written in a business-readable domain- specific language and serves as documentation, automated tests and development-aid - all rolled into one format.
  • 46. Cucumber also lets operations teams describe how infrastructure should behave in plain text. The text is written in a business-readable domain- specific language and serves as documentation, monitoring and deployment-aid - all rolled into one format.
  • 47. Functionality Monitoring http://stillalive.com
  • 48. Safety Net For Production
  • 49. Capacity Monitoring http://scoutapp.com
  • 50. Example Cucumber Monitoring Features
  • 51. Search / SEO
  • 52. Feature: Cucumber wiki discoverability In order to learn more about Cucumber As an uninformed developer I should be able easily find the GitHub wiki Scenario: Searching for Cucumber on Google When I go to http://www.google.com/ And I fill in "q" with "cucumber" And I press "Google Search" Then I should see "BDD that talks to domain experts first and code second"
  • 53. Scenario: Making sure #geekend doesn't suck When I go to http://search.twitter.com And I fill in "searchBox" with "#geekend" And I press "Search" Then I should see "geekend" And I should not see "geekend sucks"
  • 54. Email Deliverability
  • 55. Feature: Signup Emails In order to prevent bots from taking over the site A new user should receive a verification email upon signup Scenario: New User signup Given I visit "http://example.com" And I follow "Signup!" When I signup with a random email address and password And I press "Go" And I wait 10 seconds # an unfortunate reality Then I should have one email in my inbox And the email subject should match "^Welcome" And the email body should match "http://example.com/v/w+" https://github.com/technicalpickles/mailinator-spec
  • 56. Benchmarking
  • 57. Feature: slashdot.com To keep the geek masses satisfied Slashdot must be responsive Scenario: Cached pages are super quick Given I am benchmarking When I go to http://slashdot.org/ Then the elapsed time should be less than 500 milliseconds When I follow "Login" Then the elapsed time should be less than 500 milliseconds When I follow "Contact" Then the elapsed time should be less than 500 milliseconds http://github.com/auxesis/cucumber-nagios
  • 58. Existing Metrics
  • 59. Feature: Response Time As a impatient user Our web server should be in tip-top shape So our app can be super fast Background: Given my Scout account name is 'railsmachine' And my Scout email and password are 'jesse@railsmachine.com' and 'sekret' Scenario: Passenger Queue When I get the metrics from the 'Passenger' plugin on 'example.com' Then the 'passenger_queue_depth' should be 0 Scenatiro: CPU usage is low When I get the metrics from the 'Server Overview' plugin on 'example.com' Then 'cpu_last_minute' should be less than 1 http://github.com/jnewland/cucumber-scout/
  • 60. Feature: Response Time As a impatient user Our app should be super fast Background: Given my NewRelic license key is 'omgwtfbbq' Scenario: Average Response time Given that my application is being monitored by New Relic Then my application's 'response time' should be less than 500 milliseconds Scenario: Apdex Given that my application is being monitored by New Relic Then my application's 'apdex' should be 1 http://github.com/jnewland/cucumber-newrelic
  • 61. DNS
  • 62. Feature: rubygems.org As a member of the Ruby community I should be able to easily install Ruby gems Scenario: DNS When I lookup "rubygems.org" Then the name should resolve an IP http://github.com/auxesis/cucumber-nagios
  • 63. Infinite Possibilities
  • 64. Credit Card Transactions
  • 65. SSL Certificate Expiration
  • 66. Power to test and/or monitor anything and everything
  • 67. Clearly Defined Business Value
  • 68. 24 / 7 / 365
  • 69. Know before your customers do
  • 70. Know before your boss does
  • 71. Learn More about Cucumber http://cukes.info/
  • 72. Thanks! Any questions?
  • 73. Get in touch: Jesse Newland jesse@railsmachine.com @jnewland github.com/jnewland
  • 74. Flickr Creative Commons Photos http://flic.kr/p/4EjsDJ http://flic.kr/p/c1UTf http://flic.kr/p/5BGJMu http://flic.kr/p/68vjKV http://flic.kr/p/5iTuua http://flic.kr/p/rvc1 http://flic.kr/p/77oAy2 http://flic.kr/p/6y7EfX http://flic.kr/p/CdYo8 http://flic.kr/p/2Mxkhp http://flic.kr/p/k2LCm http://flic.kr/p/5t7h5 http://flic.kr/p/71vxY6 http://flic.kr/p/29qc7 http://flic.kr/p/5aZYkP http://flic.kr/p/JBaj http://flic.kr/p/79ikH2 http://flic.kr/p/smfab http://flic.kr/p/6rhqad http://flic.kr/p/4t5Qf9 http://flic.kr/p/4MdrW8 http://flic.kr/p/M8kdv http://flic.kr/p/5WuXzM http://flic.kr/p/z3eWm http://flic.kr/p/3jzrJ http://flic.kr/p/4XAQs7 http://flic.kr/p/5B4TaF http://flic.kr/p/76qpEo http://flic.kr/p/4FAf2R http://flic.kr/p/4CGsEq http://flic.kr/p/39poLP http://flic.kr/p/855mG http://flic.kr/p/6nq52E http://flic.kr/p/6Wmw9 http://flic.kr/p/yQuMG http://flic.kr/p/4UJLYB http://flic.kr/p/jZ5Ae http://flic.kr/p/5gqZah http://flic.kr/p/4yhzz http://flic.kr/p/7fcPtg http://flic.kr/p/nxAqt http://flic.kr/p/o9QvA http://flic.kr/p/4VWY5F http://flic.kr/p/4WU64g http://flic.kr/p/EKbuF http://flic.kr/p/47ErYj http://flic.kr/p/5xitHh http://flic.kr/p/oosB http://flic.kr/p/4uE9Wz http://flic.kr/p/PNrwk http://flic.kr/p/65KZaJ http://flic.kr/p/6225bv http://flic.kr/p/7JKj5H http://flic.kr/p/79HLb5 http://flic.kr/p/xiYny
  • 75. License http://creativecommons.org/licenses/by-sa/3.0/