Behaviour-Driven Development of Foundational UML Components · Behavior Driven Development (BDD)...

17
Behaviour-Driven Development of Foundational UML Components I.Lazar, S. Motogna. B. Parv Department of Computer Science Babes-Bolyai University Cluj-Napoca, Romania FESCA 2010

Transcript of Behaviour-Driven Development of Foundational UML Components · Behavior Driven Development (BDD)...

Page 1: Behaviour-Driven Development of Foundational UML Components · Behavior Driven Development (BDD) FESCA 2010 User Story/ Scenario Customer Developer Business expert Arhitect Define

Behaviour-Driven Development ofFoundational UML Components

I.Lazar, S. Motogna. B. ParvDepartment of Computer Science

Babes-Bolyai University

Cluj-Napoca, Romania

FESCA 2010

Page 2: Behaviour-Driven Development of Foundational UML Components · Behavior Driven Development (BDD) FESCA 2010 User Story/ Scenario Customer Developer Business expert Arhitect Define

Behavior Driven Development (BDD)

FESCA 2010

User Story/

Scenario

Customer

Developer

Businessexpert

Arhitect

Define requirements

Attach examples

Implement behavior

Principle: common language for system behavior specification

Principle: any system – identified, verifiable value to the business

ExecutableScenarios

Page 3: Behaviour-Driven Development of Foundational UML Components · Behavior Driven Development (BDD) FESCA 2010 User Story/ Scenario Customer Developer Business expert Arhitect Define

Concepts in BDD

FESCA 2010

Page 4: Behaviour-Driven Development of Foundational UML Components · Behavior Driven Development (BDD) FESCA 2010 User Story/ Scenario Customer Developer Business expert Arhitect Define

BDD activities as user stories

Requirementsanalysis

US1. Users add new stories to a projectUS2. Users add new scenarios to a story

Project Planning US3. Users add new iterations to a projectUS4. Users allocate stories to iterationsUS5. Developers accept stories

Development iteration

US6. Developers implement storiesUS7. Update iteration status after scenario executionUS8. Update project progress after scenario execution

Verifiable progress

US9. Users can obtain iteration status reportsUS10. Users can obtain project status reports

FESCA 2010

Page 5: Behaviour-Driven Development of Foundational UML Components · Behavior Driven Development (BDD) FESCA 2010 User Story/ Scenario Customer Developer Business expert Arhitect Define

Agile project planning

<<Scenario>>Verify story initialization

<<Scenario>>Estimate a project containing two estimated stories

<<Scenario>>Estimate a project containing an estimated story

<<Story>>Add newstories toa project{id = "US1" }

FESCA 2010

Page 6: Behaviour-Driven Development of Foundational UML Components · Behavior Driven Development (BDD) FESCA 2010 User Story/ Scenario Customer Developer Business expert Arhitect Define

Scenario description

• given "a project"

• when "a new story is created"

• then "story status should be defined" and "project should include story"

(a) Verify story initialization

• given "a project" and "two new stories"

• when "both stories have estimates"

• then "project estimate = story estimates"

(b) Estimate project =

2 estimated stories

• given "a project" and "a new story"

• when "the story is estimated"

• then "the project estimate = story estimate"

(c) Estimate project = estimated story

FESCA 2010

Page 7: Behaviour-Driven Development of Foundational UML Components · Behavior Driven Development (BDD) FESCA 2010 User Story/ Scenario Customer Developer Business expert Arhitect Define

Research problem

• BDD approach for developing executable fUML components

• fUML defines implementation-oriented abstractions - refer to Platform Independent Models (PIM).

• Refer only structural and behavioral constructs defined by the fUML specification

• tailored to the algorithmic and data-intensive types of programs

• concrete textual syntax is needed - enforces a certain way of constructing models

• generated code is meant to be complete

FESCA 2010

Page 8: Behaviour-Driven Development of Foundational UML Components · Behavior Driven Development (BDD) FESCA 2010 User Story/ Scenario Customer Developer Business expert Arhitect Define

Solution – consists of:

UML profile

Library fUML activities – equality & inclusion

Activities – executable scenarios

Concrete syntax for BDD scenarios

bUML – BDD tool for fUML models

FESCA 2010

Page 9: Behaviour-Driven Development of Foundational UML Components · Behavior Driven Development (BDD) FESCA 2010 User Story/ Scenario Customer Developer Business expert Arhitect Define

BDD profileReturn Verdict:

pass, fail, inconclusive, error

inconclusive

FESCA 2010

Page 10: Behaviour-Driven Development of Foundational UML Components · Behavior Driven Development (BDD) FESCA 2010 User Story/ Scenario Customer Developer Business expert Arhitect Define

Scenario descriptiontextual & graphical representation

FESCA 2010

• given "a project"

• when "a new story is created"

• then "story status should be defined" and "project should include story"

Page 11: Behaviour-Driven Development of Foundational UML Components · Behavior Driven Development (BDD) FESCA 2010 User Story/ Scenario Customer Developer Business expert Arhitect Define

Scenario implementation

Difficulties:

Implement scenario – return verdict

fUML primitives – low level

Implement scenario – complex

how fUML define behavior of methods

then part of scenario

Testing equality and inclusions

FESCA 2010

Page 12: Behaviour-Driven Development of Foundational UML Components · Behavior Driven Development (BDD) FESCA 2010 User Story/ Scenario Customer Developer Business expert Arhitect Define

Scenario implementation

Textual representationgiven "a project", { project = new Project }when "a new story is created", { story = project.createStory() }then “story status should be defined", { story.status shouldBe StoryStatus.Defined }and “project should include the story", { project.story shouldInclude story }

FESCA 2010

Page 13: Behaviour-Driven Development of Foundational UML Components · Behavior Driven Development (BDD) FESCA 2010 User Story/ Scenario Customer Developer Business expert Arhitect Define

shouldInclude(list[*], item[0..1]): Boolean

FESCA 2010

Page 14: Behaviour-Driven Development of Foundational UML Components · Behavior Driven Development (BDD) FESCA 2010 User Story/ Scenario Customer Developer Business expert Arhitect Define

bUML Tool

• Part of ComDeValco framework:

• extend action language

• Establish the steps of development:

– Project setting

– Requirements analysis

– Project planning

– Development iteration

– Verifiable progress

FESCA 2010

Project

fUMLmodels

UML fragment

fUMLVirtual

Machine

Requirementsanalysis

US1. Users add new stories to a projectUS2. Users add new scenarios to a story

Project Planning US3. Users add new iterations to a projectUS4. Users allocate stories to iterationsUS5. Developers accept stories

Development iteration

US6. Developers implement storiesUS7. Update iteration status after scenario executionUS8. Update project progress after scenario execution

Verifiable progress

US9. Users can obtain iteration status reportsUS10. Users can obtain project status reports

Page 15: Behaviour-Driven Development of Foundational UML Components · Behavior Driven Development (BDD) FESCA 2010 User Story/ Scenario Customer Developer Business expert Arhitect Define

Verifiable progress – remarks:

• After execution, models automatically update:

– Scenario status

– User story status.

• Different from platform dependent approaches

• Executed on models

FESCA 2010

Page 16: Behaviour-Driven Development of Foundational UML Components · Behavior Driven Development (BDD) FESCA 2010 User Story/ Scenario Customer Developer Business expert Arhitect Define

Related work

• no other existing works combine BDD and MDD approaches

• close to easyb http://www.easyb.org/ (2008)

• Business Motivation Model (BMM) and SysMLrequirements - consistency with the UML testing profile.

• Executable Acceptance Test-Driven Development (EATDD) [Park, Maurer] (2008)

FESCA 2010

Page 17: Behaviour-Driven Development of Foundational UML Components · Behavior Driven Development (BDD) FESCA 2010 User Story/ Scenario Customer Developer Business expert Arhitect Define

Thank you

FESCA 2010