Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Do you need automated
testing?
Technology Stylings by @greggles
@greggles
● Drupalero for too many years
● Founded this group
● Father of a 4 year old and 1 year old
● I work at CARD.com...
You need tests.
(this is not good marketing)
You need to floss.
(this is not good marketing)
Only floss the teeth you
want to keep.
Only floss the teeth you
want to keep.
Only test the code you
want to keep.
If you liked it then you
should have put a test on it
Do you like it?
Raise your hand if...
Why you should write tests:
● Catch bugs before they hit the live site
● Can be a tool for customer acceptance
● Be confid...
Why don’t you write tests?
Why don’t you write tests?
● It takes too long compared to benefits
Why don’t you write tests?
● It takes too long
● Other reasons that don’t matter
Bug report:
I went to CARD.com.
I look for the login link.
I should see it.
What if….?
Bug report:
I went to CARD.com.
I look for the login link.
I should see it.
What if….?
Bug report:
I went to CARD.com.
I look for the login link.
I should see it.
Behat test
Given I go to "https://w...
What if….?
Behat test:
Given I go to "https://www.card.com"
And I click "login"
Then I should see "Log in"
A behat “feature”
● Written in Gherkin syntax
● Starts with Benefit, Role, Feature:
○ In order to log in
○ As an anonymous...
A Behat “feature”
● Written in Gherkin syntax
● Starts with Benefit, Role, Feature:
○ In order to log in
○ As an anonymous...
DEMO TIME
What got demoed
● One way to install behat
● One way to run behat
● Running some
● Using goutte driver
● Using drush black...
Anyone can write behat tests
Lots of ways to do Behat
● Drupalextension
● composer install
● bin/behat --init
● bin/behat
More fun features
Tags!
bin/behat -dl
selenium
junit output and graphing!
travis-ci
etc.!
debugging
selenium
printing
editing context
Resources
http://behat.org/ http://docs.behat.org
http://www.slideshare.net/jmikola1/pratical-bdd-
with-behat-and-mink
htt...
http://www.velocitypartners.net/blog/2014/01/28/agile-testing-
the-agile-test-automation-pyramid/
Doing:
Should do:
“You Cannot Manage What You Cannot Measure” - Bill Hewlett
Remember: Only test the code you want to keep.
Only Test the Features You Want to Keep
Only Test the Features You Want to Keep
Only Test the Features You Want to Keep
Upcoming SlideShare
Loading in …5
×

Only Test the Features You Want to Keep

1,484 views

Published on

This is a quick presentation introducing the idea of automated testing, giving some reasons to do it, showing one way to do automated UI testing using Behat, and then pointing to more resources.

Published in: Internet, Technology, Education
  • Be the first to comment

Only Test the Features You Want to Keep

  1. 1. Do you need automated testing? Technology Stylings by @greggles
  2. 2. @greggles ● Drupalero for too many years ● Founded this group ● Father of a 4 year old and 1 year old ● I work at CARD.com ● curl -I https://www.card.com ● CARD.com/careers
  3. 3. You need tests. (this is not good marketing)
  4. 4. You need to floss. (this is not good marketing)
  5. 5. Only floss the teeth you want to keep.
  6. 6. Only floss the teeth you want to keep.
  7. 7. Only test the code you want to keep.
  8. 8. If you liked it then you should have put a test on it Do you like it?
  9. 9. Raise your hand if...
  10. 10. Why you should write tests: ● Catch bugs before they hit the live site ● Can be a tool for customer acceptance ● Be confident your code covers all cases ● More confidence you can deploy code ○ Faster iterations ● Spend less on manual QA ● Team morale improves ● Wizards will give you their magic wands
  11. 11. Why don’t you write tests?
  12. 12. Why don’t you write tests? ● It takes too long compared to benefits
  13. 13. Why don’t you write tests? ● It takes too long ● Other reasons that don’t matter
  14. 14. Bug report: I went to CARD.com. I look for the login link. I should see it.
  15. 15. What if….? Bug report: I went to CARD.com. I look for the login link. I should see it.
  16. 16. What if….? Bug report: I went to CARD.com. I look for the login link. I should see it. Behat test Given I go to "https://www.card.com" When I click "login" Then I should see "Log in"
  17. 17. What if….? Behat test: Given I go to "https://www.card.com" And I click "login" Then I should see "Log in"
  18. 18. A behat “feature” ● Written in Gherkin syntax ● Starts with Benefit, Role, Feature: ○ In order to log in ○ As an anonymous user ○ I need to use the login link from the header
  19. 19. A Behat “feature” ● Written in Gherkin syntax ● Starts with Benefit, Role, Feature: ○ In order to log in ○ As an anonymous user ○ I need to use the login link from the header ● Contains Scenarios ● Which have Context, Events, Outcome
  20. 20. DEMO TIME
  21. 21. What got demoed ● One way to install behat ● One way to run behat ● Running some ● Using goutte driver ● Using drush blackbox driver
  22. 22. Anyone can write behat tests
  23. 23. Lots of ways to do Behat ● Drupalextension ● composer install ● bin/behat --init ● bin/behat
  24. 24. More fun features Tags! bin/behat -dl selenium junit output and graphing! travis-ci etc.!
  25. 25. debugging selenium printing editing context
  26. 26. Resources http://behat.org/ http://docs.behat.org http://www.slideshare.net/jmikola1/pratical-bdd- with-behat-and-mink https://drupal.org/project/drupalextension http://dspeak.com/drupalextension/ https://groups.drupal.org/behat http://mink.behat.org/
  27. 27. http://www.velocitypartners.net/blog/2014/01/28/agile-testing- the-agile-test-automation-pyramid/ Doing: Should do:
  28. 28. “You Cannot Manage What You Cannot Measure” - Bill Hewlett
  29. 29. Remember: Only test the code you want to keep.

×