CSC/ECE 517 Fall 2014/ch1a 25 rs

From Expertiza_Wiki
Revision as of 00:07, 8 October 2014 by Rgschaef (talk | contribs) (→‎JBehave)
Jump to navigation Jump to search

JBehave

Behavior Driven Development

Overview

Behavior driven design (BDD) exists as an extension to Test Driven Development(TDD). Overall, BDD can be thought of as a specialized form of TDD that utilizes specialized tools (such as JBehave) to accomplish similar tasks with more emphasis on the accessibility of the program tests as opposed to the rigid, structured format of conventional acceptance tests.

Comparison to Test Driven Development

The language used for test cases immediately distinguishes BDD from TDD. Also, in BDD, the test cases emcompass both the specification for the program as well as the actual test case.

Background

JBehave is a Java-based framework that aims to function as a fully fledged development paradigm, utilizing communication and automation while using behavior based language in its descriptors. JBehave is the first ever created Behavior Driven Design platform, completed by Dan North.

Concepts

Three Core Principles

<ol start="1"

  • Business and Technology should refer to the same system in the same way - ItsAllBehaviour
  • Any system should have an identified, verifiable value to the business - WheresTheBusinessValue
  • Up-front analysis, design and planning all have a diminishing return - EnoughIsEnough

    Stories

    A story is fundamentally defined as an "automatically executable increment of business functionality." We can think of this as a single component of functionality. Stories are further comprised of scenarios, which are defined as concrete examples of the behavior of the system. In other words, a specific instance of an implementation of a story. Scenarios are further broken down into steps, which are single statements that detail (step by step, if you will) exactly how a scenario will play out.


    Keywords

    BDD relies on the use of a small vocabulary to minimize miscommunication and to ensure that everyone involved (business, developers, testers, analysts and managers) are not only on the same page but using the same words.

    Given, When, and Then are keywords utilized when writing JBehave scenarios. A scenario can have any number of steps and a story can contain many scenarios.

    Given details the premises of the test, When details the exact incident, and Then details the expected outcome. To re-emphasize, the english readability is a novelty of BDD concepts.

    Example of general story format:

    Narrative:
    In order to communicate effectively to the business some functionality
    As a development team
    I want to use Behaviour-Driven Development
         
    Scenario:  A scenario is a collection of executable steps of different type
     
    Given step represents a precondition to an event
    When step represents the occurrence of the event
    Then step represents the outcome of the event
     
    Scenario:  Another scenario exploring different combination of events
     
    Given a precondition
    When a negative event occurs
    Then a the outcome should be captured  
    

    Five Step Overview

    Integrating with Eclipse

    Using the Eclipse Installer:

    1. Help > Install New Software...
    2. Add the new site location http://jbehave.org/reference/eclipse/updates/

    3. Select JBehave Eclipse feature and follow standard Eclipse installation procedure

    Examples

    References

    1. http://jbehave.org/
    1. http://en.wikipedia.org/wiki/Behavior-driven_development
    1. http://www.ryangreenhall.com/articles/bdd-by-example.html
    1. http://behaviour-driven.org/