by maciej klepacki characteristics of specification by
play

by Maciej Klepacki Characteristics of Specification By Example - PowerPoint PPT Presentation

Specification By Example smarter way to create software by Maciej Klepacki Characteristics of Specification By Example (Behavior Driven Development) Scope is directly steered by business goals User Stories are created together with


  1. Specification By Example smarter way to create software by Maciej Klepacki

  2. Characteristics of Specification By Example (Behavior Driven Development) • Scope is directly steered by business goals • User Stories are created together with business – this is critical for SBE success • Scenarios are written in natural language with keywords • Scenarios describe key ways to use the system • Scenarios are: - Requirements Specification – a living documentation - Test Scripts for UAT - Basis for automated regression tests - Check-list for developer

  3. Construction of User Story - Feature • Clear Title Good Feature: User sends information to Service support Bad Feature: Using Webform • Clear business goal (not easy!) As a Service user I want to inform Service support about my problem So that the problem gets resolved  • Definiton of preconditions for all scenarios Background: Given I am a Service User And I have Service web form page open

  4. Construction of User Story - Scenario • User Action System Reaction • When I choose my <location> Then a new ticket is created, containing: And I enter <title> of the message | <title>| <description> | <priority> | And I enter <description> of the problem And is assigned to proper <group> based on <location> And I define the <priority> of the problem And I send the entered information • Set of example data (for Scenario Outline) Example: | title | description | priority | impact | location| group | |Problem!| Test Test Test | Urgent | High | Polska | Europe |

  5. Non-functional requirements and SbE Example: Security Given I am an Authorized User Availability And I operate between 9 to 17 Capacity And less than 1000 users are logged in Performance When I open XYZ page Then it loads in less than 5 seconds ... other non-functional requirements can be described in similar way!

  6. User Stories as backbone in SBE User Story (Given/When/Then) Testers Alternate scenarios Developers Happy path scenarios Analyst Features

  7. How does SbE fit to standard documentation Features = User Requirements Specification Scenarios = Functional & Non-functional Specification Examples = Test Data

  8. Why automate tests with SBE approach? • Test Automation is based on natural language – it is easy to understand what the test does. • It is possible to create first single function tests and then combine them into more complex regression tests matching Business Flow for. • It is easy to choose the right tests for execution and to maintain them later. • It is possible to distinct test scenario creation from technical implementation – possibility to use people with different skills . • It is a way to standardize test script language. • It is easy to report automated tests outcome. • Implementations for different languages present: Ruby, Java, Python, .NET and more.

  9. SbE implementations • Specflow – C#: http://www.specflow.org/ • Cucumber – Ruby (also ported to: java, python, php): http://cukes.info/ • Rbehave – Ruby: http://dannorth.net/2007/06/17/introducing-rbehave/ • Jbehave - Java: http://jbehave.org/

  10. Why .NET implementation? • Visual Studio offers greater productivity then Eclipse for SBE • Specflow for .NET integrates seamlessly with Visual Studio – no interfaces needed • NUnit offers more functions then JUnit • Great reporting tool out-of-the-box • Relatively flat learning curve for new users (rich training materials from Microsoft)

  11. Scheme of SBE implementation using .NET: SpecFlow+Webdriver+NUnit SPECFLOW Feature Is read HTML + Scenario parser pre i post Report procesor (Given/When/Then) Test List Step Nunit XML Generates Definition Test execution Report Uses Test result Calls Reaction Webdriver Page Browser Uses Action Browser steering Objects

  12. Show of code structure • Visual Studio file structure • Nunit test suite structure

  13. References for Specification by Example and BDD: • http://dannorth.net/whats-in-a-story/ • http://specificationbyexample.com/ • http://en.wikipedia.org/wiki/Behavior-driven_development Webdriver test automation: • http://docs.seleniumhq.org/projects/webdriver/ • http://docs.seleniumhq.org/docs/03_webdriver.jsp

  14. Any questions?

Recommend


More recommend