Your SlideShare is downloading. ×
0
Perl Behavior Driven Development (BDD)
Perl Behavior Driven Development (BDD)
Perl Behavior Driven Development (BDD)
Perl Behavior Driven Development (BDD)
Perl Behavior Driven Development (BDD)
Perl Behavior Driven Development (BDD)
Perl Behavior Driven Development (BDD)
Perl Behavior Driven Development (BDD)
Perl Behavior Driven Development (BDD)
Perl Behavior Driven Development (BDD)
Perl Behavior Driven Development (BDD)
Perl Behavior Driven Development (BDD)
Perl Behavior Driven Development (BDD)
Perl Behavior Driven Development (BDD)
Perl Behavior Driven Development (BDD)
Perl Behavior Driven Development (BDD)
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Perl Behavior Driven Development (BDD)

2,637

Published on

Introduction to Perl Behavior Driven Development. The objective is to have the business analysts write tests for you in the form of user-stories.

Introduction to Perl Behavior Driven Development. The objective is to have the business analysts write tests for you in the form of user-stories.

Published in: Technology, Education
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,637
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
16
Comments
0
Likes
2
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

Transcript

  • 1. Behavior DrivenDevelopment inPerlTudor Constantin - perl hacker @ Evozon
  • 2. Contents● Objectives● TDD and its disadvantages● How BDD works● BDD and The Mojolicious-Boilerplate● Wishlist● Conclusions● References
  • 3. ObjectivesAssuming you have the following user story toimplement:Feature: Standard Signup In order to begin using the application As a new user I want to create an accountScenario: Signup with valid email/password combination Given I do not have an account When I signup with email and password Then I should be logged in And my profile details should be filled in
  • 4. ObjectivesFollowing TDD, youd have to start writing teststhat will guarantee your app functionality
  • 5. ObjectivesObjective achievedWith BDD, that user story IS your test suite forthat scenarioPerl BDD Module:● Peter Sergeants Test::BDD::Cucumber
  • 6. ObjectivesFeature: Standard Signup In order to begin using the application As a new user I want to create an accountScenario: Signup with valid email/password combination Given I do not have an account When I signup with email and password Then I should be logged in And my profile details should be filled inLegend:(this text is parsed by the BDD framework)(your actual test knows what to do with this text)
  • 7. TDD and its disadvantages● Where to start● What to test and what not to test● How much to test in one go● What name should that test have● How to organize the tests in files● How to setup and share context between tests
  • 8. How BDD Works1. Stakeholders write a formal user story a. Feature section - free form text describing that particular feature of the application b. Background section - parsable text meant to set up the context for testing that feature - ex: "Given I am logged in as administrator" i. each Feature might have a Background section c. Scenario(s) section(s) i. each feature has one or more scenarios d. Steps i. each scenario has one or more steps
  • 9. How BDD Works2. The developer implements each stepExample of Implementation for the stepGivena mojo test object for the"Boilerplate" application
  • 10. How BDD WorksGiven qr/a mojo test object for the "(.+)"application/, func ($c) { use_ok( $1 ); my $tm = Test::Mojo->new( $1 ); ok( $tm, "Object created" ); $c->stash->{feature}->{tm} = $tm; ok( $c->stash->{feature}->{tm}, "Gotour Test::Mojo object" ); };
  • 11. BDD and The Mojolicious-Boilerplate● Started using BDD as the way to test apps using the Mojolicious-Boilerplate● There are passing scenarios● There are failing scenarios● Get involved and take on the opportunity to learn BDD in practice
  • 12. BDD and The Mojolicious-BoilerplateScenario file: Mojolicious-Boilerplate / t / features / mojo.feature
  • 13. BDD and The Mojolicious-BoilerplateSteps File: Mojolicious-Boilerplate / t / features / step_definitions / mojo_steps.pl
  • 14. Wishlist Road Map● Create more scenarios/user-stories● Find a way to get a more convenient map between Mojolicious Routes, URL display text and URL value● Create a Bootstrap-specific grammar ○ will make the testing process even less "programmer bound" ○ most HTML elements are contained in tags with Bootstrap specific css classes● More, better documentation
  • 15. Conclusions● easy way to get started in writing tests● test-scenarios and tests are self documented● natural way of logically split the test files into functionality related files/folders/objects
  • 16. References● http://en.wikipedia.org/wiki/Behavior_Driven_Development● Peter Sergeants Test::BDD::Cucumber::Manual::Tutorial● Mojolicious Boilerplate● Story Driven Development With Cucumber

×