CSC/ECE 517 Fall 2014/ch1a 25 rs: Difference between revisions
Line 52: | Line 52: | ||
<li>Add the new site location http://jbehave.org/reference/eclipse/updates/ | <li>Add the new site location http://jbehave.org/reference/eclipse/updates/ | ||
[[File:step2eclipse.png]] | [[File:step2eclipse.png]]<br><br> | ||
<li>Select JBehave Eclipse feature and follow standard Eclipse installation procedure | <li>Select JBehave Eclipse feature and follow standard Eclipse installation procedure | ||
[[File:step3eclipse.png]] | [[File:step3eclipse.png]] |
Revision as of 23:59, 7 October 2014
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.
Concepts
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
When writing tests, a story is the text that encompasses many scenarios.
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:
- Help > Install New Software...
- Add the new site location http://jbehave.org/reference/eclipse/updates/
- 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