behat amp bdd
play

{Behat & BDD} Luis Ribeiro Systems Architect ciandt.com - PowerPoint PPT Presentation

{Behat & BDD} Luis Ribeiro Systems Architect ciandt.com Presenter Luis Ribeiro > Systems Architect at CI&T > +5Years Drupal experience > Large Open Source experience > Working with ~150 Drupallers ciandt.com Why


  1. {Behat & BDD} Luis Ribeiro Systems Architect ciandt.com

  2. Presenter Luis Ribeiro > Systems Architect at CI&T > +5Years Drupal experience > Large Open Source experience > Working with ~150 Drupallers ciandt.com

  3. Why automated tests ? ciandt.com

  4. Why automated tests ? Improve the Speed Test Coverage Efficiency Testers Motivation Less Human Resources SAVE BIG MONEY ciandt.com

  5. BDD – Behavior Driven Development ciandt.com

  6. BDD – Behavior Driven Development How the customer explained it ciandt.com

  7. BDD – Behavior Driven Development How the project leader understood it ciandt.com

  8. BDD – Behavior Driven Development How the programmer wrote it ciandt.com

  9. BDD – Behavior Driven Development What the customer really need it ciandt.com

  10. BDD – Behavior Driven Development What the testers received ciandt.com

  11. BDD – Behavior Driven Development example-based communication business and developers can clearly understand ciandt.com

  12. Behat “How the Individual parts work” ciandt.com

  13. Behat Gherckin “Defining your behavior” ciandt.com

  14. Behat Gherckin Structure 1- FEATURES 2- SCENARIOS 3- STEPS ciandt.com

  15. Behat ciandt.com

  16. Behat 1- Given Defines the initial state of the system for the scenario 2- When Describes the action taken by the person/role 3- Then Describes the observable system state after the action has been performed 4- And/But Can be added to create multiple Given/When/Then lines ciandt.com

  17. Behat Example Read news in Portuguese Feature: Feature: I18n I18n In In order order to to read read news news in in portuguese portuguese As As a a Brazilian Brazilian user user I need need to to be be able able to to switch switch locale locale ciandt.com

  18. Behat ciandt.com

  19. Behat Example Feature: Feature: Add Add new new Article Article In order In order to to manage manage a a newsletter newsletter As As a a site site site site administrat administrator or I I need need to to be be able able to to add add new new content content Scenario: Scenario: Add Add new new content content for News for News Given I Given I go go to to “http:// “http://ur url/a /admi min/ n/new ews” When When I I click click “New “New Article” Article” And I And I fill fill “Title” “Title” with with “My “My Title” Title” And And I I press press “Save” “Save” Then Then I I should should see see “A “A New New content content was added” was added” ciandt.com

  20. ciandt.com

  21. Behat ..is a BDD (behavior driven development) framework for PHP. ciandt.com

  22. Behat How Behat works ? maps each step(s) in a PHP Callback ciandt.com

  23. Behat Setup ciandt.com

  24. Behat Requirements Requirements PHP higher than 5.3.5 Libraries installed: curl Ø mbstring Ø xml Ø ciandt.com

  25. Behat Requirements Behat is a library easily installed using composer ciandt.com

  26. Behat Setup Step1 1- Create a composer file “composer.json” 2- Add the below lines 3- run the command “composer install” ciandt.com

  27. Behat Setup Step 2 1- Create a configuration file called “ behat.yml ” 2- Add the below lines 3- run the command “ bin/behat --init ” ciandt.com

  28. Behat Setup Step 3 1- run the command “ bin/behat -dl ” ciandt.com

  29. DEMO ciandt.com

  30. Drupal Extension ciandt.com

  31. Drupal Extension 1- Set up test data with Drush or the Drupal API 2- Define theme regions and test data appears within them 3- Clear the cache, log out, and other useful steps 4- Detect and discover steps provided by Drupal Specific contributed modules and themes Functionalities for BDD using Behat and Mink ciandt.com

  32. Drupal Extension Drupal Extension Drivers ciandt.com

  33. Drupal Extension Drupal extension .yml examples ciandt.com

  34. Drupal Extension Drupal extension Feature example ciandt.com

  35. Drupal Extension Customizing Behat ciandt.com

  36. Drupal Extension What next ? ciandt.com

  37. Smoke Test Time spent to learn, setup & Logo start to implement Behat Before Behat = 4 Hours ~ 5 hours After Behat = 25 minutes <Insert here an image> <Insert here an image> QA resources reduced [text] from 3 to 1 ciandt.com

  38. Final Considerations 1- EASY TO LEARN 2- POWERFULL 3- EXTENSIBLE ciandt.com

  39. Thank you! Sources http://behat.org/ http://behat-drupal-extension.readthedocs.io/ Luis Ribeiro luisr@ciandt.com ciandt.com

  40. ? ciandt.com

Recommend


More recommend