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

by maciej klepacki characteristics of specification by
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

Specification By Example

smarter way to create software

by Maciej Klepacki

slide-2
SLIDE 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
slide-3
SLIDE 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

slide-4
SLIDE 4

Construction of User Story - Scenario

  • User Action

When I choose my <location> And I enter <title> of the message And I enter <description> of the problem 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 |

  • System Reaction

Then a new ticket is created, containing: | <title>| <description> | <priority> | And is assigned to proper <group> based on <location>

slide-5
SLIDE 5

Non-functional requirements and SbE

Example: Given I am an Authorized User And I operate between 9 to 17 And less than 1000 users are logged in When I open XYZ page Then it loads in less than 5 seconds

Security Availability Capacity Performance

... other non-functional requirements can be described in similar way!

slide-6
SLIDE 6

User Stories as backbone in SBE

User Story (Given/When/Then) Testers Analyst Developers

Features Happy path scenarios Alternate scenarios

slide-7
SLIDE 7

How does SbE fit to standard documentation

Features = User Requirements Specification Scenarios = Functional & Non-functional Specification Examples = Test Data

slide-8
SLIDE 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.

slide-9
SLIDE 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/

slide-10
SLIDE 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)
slide-11
SLIDE 11

Scheme of SBE implementation using .NET: SpecFlow+Webdriver+NUnit

SPECFLOW parser pre i post procesor Feature + Scenario

(Given/When/Then)

Step Definition Page Objects Webdriver

Browser steering

Nunit

Test execution

HTML Report XML Report Browser Calls Uses Action Uses Test List Reaction Test result Generates Is read

slide-12
SLIDE 12

Show of code structure

  • Visual Studio file structure
  • Nunit test suite structure
slide-13
SLIDE 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
slide-14
SLIDE 14

Any questions?