• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Bdd and spec flow
 

Bdd and spec flow

on

  • 2,443 views

This is the slide deck from my devtea

This is the slide deck from my devtea

Statistics

Views

Total Views
2,443
Views on SlideShare
2,313
Embed Views
130

Actions

Likes
3
Downloads
55
Comments
0

6 Embeds 130

http://www.charlesnurse.com 107
http://charlesnurse.com 16
http://localhost 4
http://charlesnurse.keydance.com 1
http://feeds.feedburner.com 1
http://translate.googleusercontent.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • http://en.wikipedia.org/wiki/Behavior_Driven_Developmenthttp://behaviour-driven.org/
  • BDD is driven by business value[6]; that is, the benefit to the business which accrues once the application is in production. The only way in which this benefit can be realized is through the user interface(s) to the application, usually (but not always) a GUI.In the same way, each piece of code, starting with the UI, can be considered a stakeholder of the other modules of code which it uses. Each element of code provides some aspect of behavior which, in collaboration with the other elements, provides the application behavior.The first piece of production code that BDD developers implement is the UI. Developers can then benefit from quick feedback as to whether the UI looks and behaves appropriately. Through code, and using principles of good design and refactoring, developers discover collaborators of the UI, and of every unit of code thereafter. This helps them adhere to the principle of YAGNI, since each piece of production code is required either by the business, or by another piece of code already written.BDD focuses on obtaining a clear understanding of desired software behavior through discussion with stakeholders. It extends TDD by writing test cases in a natural language that non-programmers can read. Behavior-driven developers use their native language in combination with the ubiquitous language of domain-driven design to describe the purpose and benefit of their code. This allows the developers to focus on why the code should be created, rather than the technical details, and minimizes translation between the technical language in which the code is written and the domain language spoken by the business, users, stakeholders, project management, etc
  • Establishing the goals of different stakeholders required for a vision to be implementedDrawing out features which will achieve those goals using feature injectionInvolving stakeholders in the implementation process through outside–in software developmentUsing examples to describe the behavior of the application, or of units of codeAutomating those examples to provide quick feedback and regression testingUsing 'should' when describing the behavior of software to help clarify responsibility and allow the software's functionality to be questionedUsing 'ensure' when describing responsibilities of software to differentiate outcomes in the scope of the code in question from side-effects of other elements of code.Using mocks to stand-in for collaborating modules of code which have not yet been written

Bdd and spec flow Bdd and spec flow Presentation Transcript

  • BDD with Visual Studio 2010, SpecFlow and WATIN Charles Nurse Senior Architect, DotNetNuke Corp.
  • BDD with Visual Studio 2010, SpecFlow and WATINWho Am I• ASP.NET MVP (since Jan 2007)• ASPInsider (since Jan 2008)• Senior Architect, DotNetNuke Corporation• Web: www.dotnetnuke.com• Blog: www.charlesnurse.com• Email: charles.nurse@dnncorp.com• Twitter: @cnurse
  • BDD with Visual Studio 2010, SpecFlow and WATINAgenda• Intro to BDD• Gherkins• SpecFlow• WatiN
  • BDD with Visual Studio 2010, SpecFlow and WATINPart I – Behavior Driven Development• Developed by Dan North• Response to some issues with TDD  Where to start  What to test and what not to test  How much to test in one go  What to call the tests  How to understand why a test failsBDD is a second-generation, outside–in, pull-based, multiple-stakeholder, multiple-scale, high-automation, agile methodology. It describes acycle of interactions with well-defined outputs, resulting in the delivery ofworking, tested software that matters. Dan North
  • BDD with Visual Studio 2010, SpecFlow and WATINPart I – Behavior Driven Development• Driven by Business Value• Realized through the Interface (GUI)• Tests are defined in a natural language (Gherkins)
  • BDD with Visual Studio 2010, SpecFlow and WATINPart I – Behavior Driven Development• BDD Practices  Establish the goals of different stakeholders  Drawing out features which will achieve those goals using feature injection  Involve stakeholders through outside–in software development  Use examples to describe the behavior of the application  Automate those examples to provide feedback and regression testing  Use should when describing the behavior of software  Use ensure when describing responsibilities of software  Use mocks to stand-in for modules of code which have not yet been written
  • BDD with Visual Studio 2010, SpecFlow and WATINPart 2 – Gherkins• Natural Language definition of tests.  TDD – Arrange, Act, Assert• Gherkin – Given, When, Then  Given – defines the conditions that must exits for the test to be run  When – defines the action a “user” will execute  Then – defines the expectations of the Test• Gherkins Frameworks  Cucumber – Ruby  Lettuce – Python  Specflow - .NET
  • BDD with Visual Studio 2010, SpecFlow and WATINPart 2 – Gherkins• Example – "Refunded or exchanged items should be returned to stock.“• Customer, Product Manager, Developer or QA engineer might clarify the requirements by breaking this down into specific scenarios• Scenario 1: Refunded items should be returned to stock• Scenario 2: Replaced items should be returned to stock
  • BDD with Visual Studio 2010, SpecFlow and WATINPart 2 – Gherkins• Scenario 1: Refunded items should be returned to stock  Given a customer previously bought a black sweater from me  and I currently have three black sweaters left in stock  When he returns the sweater for a refund  Then I should have four black sweaters in stock
  • BDD with Visual Studio 2010, SpecFlow and WATINPart 2 – Gherkins• Scenario 2: Replaced items should be returned to stock  Given that a customer buys a blue garment  and I have two blue garments in stock  and three black garments in stock.  When he returns the garment for a replacement in black,  Then I should have three blue garments in stock  and two black garments in stock
  • BDD with Visual Studio 2010, SpecFlow and WATINPart 2 – Gherkins• Programmer-domain examples• Example 1: New lists are empty  Given a new list  Then the list should be empty• Example 2: Lists with things in them are not empty  Given a new list  When we add an object  Then the list should not be empty
  • BDD with Visual Studio 2010, SpecFlow and WATINPart 3 – SpecFlow• SpecFlow aims at bridging the communication gap between domain experts and developers by binding business readable behavior specifications to the underlying implementation. SpecFlow.org• Visual Studio Extension – to support Gherkin language tests  www.specflow.org  https://github.com/techtalk/SpecFlow• SpecFlow Demo
  • BDD with Visual Studio 2010, SpecFlow and WATINPart 3 – SpecFlow• Demo Summary• Review of SpecFlow in VS 2010  Reviewed the Extension Manager Addin  Reviewed the Nuget Package (SpecFlow/NUnit) integration)  Added a SpecFlow Feature  Run SpecFlow Scenarios  Added Steps File  Updated Feature  Updated Steps File
  • BDD with Visual Studio 2010, SpecFlow and WATINPart 4 – WatiN• Browser Automation Framework  Web Application Testing in .NET  http://watin.org/• Inspired by WatiR (Web Application Testing in Ruby)• Supports IE (6+) or Firefox (2+)• Licensed under Apache License 2.0• Available as a Nuget package
  • BDD with Visual Studio 2010, SpecFlow and WATINPart 4 – WatiN• Automate all major HTML elements with ease• Find elements by multiple attributes• Native support for Page and Control model.• Supports AJAX website testing• Supports creating screenshots of webpages• Supports frames (cross domain) and IFrames
  • BDD with Visual Studio 2010, SpecFlow and WATINPart 4 – WatiN• Handles popup dialogs like alert, confirm, login etc..• Supports HTML dialogs (modal and modeless)• Easy to integrate with your favorite (unit) test tool• Can be used with any .Net Language• Downloaded more than 120,000 times.• Since its open source you can add/contribute new features yourself!
  • BDD with Visual Studio 2010, SpecFlow and WATINPart 4 – WatiN• Demo• Finish the Tests
  • BDD with Visual Studio 2010, SpecFlow and WATINPart 4 – WatiN• Demo Summary• Review of SpecFlow in VS 2010  Reviewed the Nuget Package (WatiN) integration)  Completed the SpecFlow Scenario  Added a second SpecFlow Scenario  Reviewed a real Scenario in a real Application
  • BDD with Visual Studio 2010, SpecFlow and WATINNext Steps• Get Specflow  www.specflow.org  https://github.com/techtalk/SpecFlow• Get WatiN • http://watin.org/
  • BDD with Visual Studio 2010, SpecFlow and WATINThank You• Email: charles.nurse@dnncorp.com• Blog: www.charlesnurse.com• Twitter: @cnurse