Download presentation
Presentation is loading. Please wait.
Published byRosa Cooper Modified over 9 years ago
1
SapientGovernmentServices Put Your Behat On! 10/9/2015 A Better Way to Test for the Future
2
SapientGovernmentServices Put Your Behat On! Ali McIntosh amcintosh@sapient.com ali@simpleinformation.com https://www.linkedin.com/in/alimci ntosh
3
3 Background Run Behat Write Script Expand Behat Best Uses Objectives
4
4 Is an open source behavior-driven development framework Allows you to write “human-readable” tests Integrates perfectly with Drupal https://www.drupal.org/pr oject/drupalextension Behat is…
5
5 Describe exactly what you are testing in your own language Gherkin language Provides a usable and searchable list of scenarios/scenario structure Always start with following scenario keywords( given, when, then, and, but) “Human-Readable”?
6
6 A test is made up of a Feature – describe your goals for the test Scenario – layout the the path the test will follow Scenario outline – test multiple variables in the same test Cause and Effect
7
7 Every scenario we lay out will start with key words. These are the steps of our feature Given – known state When – key action Then - observe And, But – expand on state, action and observation Steps
8
8 Given /** * Moves user to the specified path. * * @Given /^I am in the "([^"]*)" path$/ * * @param string $path */ public function iAmInThePath($path) { $this->moveToNewPath($path); } Statements in Code
9
9 Expand Functionality
10
10 Behat integrates with Selenium and other browser emulators Easy to pick up Can be added to any project any time Can fit any project Can ease post launch task work load once implemented Useful you ask?
11
11 Goes hand and hand with Behat and Drupal Mink removes API differences between different browser emulators Mink
12
12 Quick Intro to Behat http://docs.behat.org/en/v2.5/quick_i ntro.html Gherkin Syntax http://docs.behat.org/en/v2.5/guides/ 1.gherkin.html Nice Tutorial http://code.tutsplus.com/tutorials/bd d-with-behat--net-36171 Step Definitions http://docs.behat.org/en/v2.5/guides/ 2.definitions.html Testing Features Guide http://docs.behat.org/en/v2.5/guides/ 4.context.html Behat Cheatsheet http://blog.lepine.pro/images/2012- 03-behat-cheat-sheet-en.pdf Resources
13
Thank You
14
Arlington Office 1515 N. Courthouse Rd 4 th Floor Arlington, VA 22201 Sapientgov.com /sapientgov@sapientgovernme nt @sapientg ov /company/sapient-government- services Thank You Ali McIntosh 410-306-5663 amcintosh@sapient.com
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.