SESSION CODE: DPR 302 David Starr Pluralsight Instructor ALM Consultant Visual Studio ALM MVP starr@pluralsight. com Blog: Elegant. Code. com @elegantcoder
Paper Whiteboards Visio Power. Point Sketch. Flow
As a I want So that Given When Then Desirements are things w e wish the software did. But it doesn’t. Yet.
Story: As a I want So I can Scenario: Given When Then the other Items are still in the Cart And the Cart Item Count is correct And the Cart Subtotal reflects the remaining Items
Customer Developer Domain Concepts Given a searcher finds a recipe … UI Element Behavior Given the button was clicked … Input Validation Given credit card is valid format … Services Given credit card is charged … Class Behavior Given the Name property is null … Repositories Given the record exists …
As a I want So that Given When Then Given When Then
[Test. Method] public void Total_Should_Be_1_When_1_Product_Added() { Given var cart = new Shopping. Cart("TEST"); When cart. Add. Item(new Product("SKU")); Then Assert. Are. Equal(1, cart. Total. Items); }
Establish Initial Context User Story Structure AAA Context Specification Interact with SUT Check the results Given When Then Arrange Act Assert Set. Context Because. Of It. Should
Shared Context Create an empty cart Final Test Add a Product and check Sub. Total Add 2 Products and check Sub. Total
Base Context Inherited Context Add another of same Product Add Product to Cart Add a different Product Final Test Check Cart Subtotal Check Cart Item Count
starr@pluralsight. com Blog: Elegant. Code. com @elegantcoder
Sign up for Tech·Ed 2011 and save $500 starting June 8 – June 31 st http: //northamerica. msteched. com/registration You can also register at the North America 2011 kiosk located at registration Join us in Atlanta next year