user stories

42
User Stories 1 Wednesday, January 23, 13

Upload: richard-green

Post on 04-Dec-2014

1.124 views

Category:

Documents


2 download

DESCRIPTION

User Stories presentation given to Agile Groupies meeting on

TRANSCRIPT

User Stories

1Wednesday, January 23, 13

User Storiesand their friends:

Use Cases, Scenarios, Personas,Gherkins and Kanbans

Who writes user stories? What is a user story?When is it written?Where are they seen?Why is it written?How are they written?How are they used?

7 W’s

2Wednesday, January 23, 13

Whenever you want to explain something, it is often useful to consider the W’s.

Who, what, when, where, why start with W.How does it work?How much . . .? The How’s end with W.

A user

storyidentifies

an idea.3Wednesday, January 23, 13

A user story identifies an idea.

User Story - What is it?• Template:

As a <role name>, I need <business capability>, in order to <business benefit statement>.

• A user story is a reminder to have a deeper conversation with the user (or user rep).

• It provides a place-holder in the backlog.

4Wednesday, January 23, 13

What is it?Here is the standard template for a user story.

The purpose of a user story is to serve as a reminder to have a deeper conversation with the user later.

The card or sticky-note provides a place-holder in the backlog.

User Story What, When, Where, Why, Who

• What: Short description of a want/need.

• When: Someone (?) thinks of a new feature.

• Who: The “business” prioritizes requests.

• Why: Track the request and resulting work.

• Where: Story cards are seen on Kanban boards.

5Wednesday, January 23, 13

What is it?

It is a short description of a user`s want or need.

Speaking of that, you need to keep track of where it came from.If it sits in the backlog very long, you may forget who proposed or asked for that feature.

User Story What, When, Where, Why, Who

• Example:- As a product owner,I need to know who is using which features,in order to justify budgets and prioritize maintenance.

• Who: which role / persona

• needs What: some product feature

• Why: expected benefit.

6Wednesday, January 23, 13

Here is an example of a user story.

It has its own W`s - What is wanted by whom and why.

When someone thinks of a new

feature.

7Wednesday, January 23, 13

You can write a user story whenever anyone things of a new feature.

But most user stories come from the business - the owners and users of the system.

But beware of ideas that don’t come from actual end-users.They may sound neat or just serve a single user`s whim.Business managers are notorious. They may ask for a report that they only read once.

User Story What, When, Where, Why, Who

• What: Short description of a want/need.

• When: Someone (?) thinks of a new feature.

• Who: The “business” prioritizes requests.

• Why: Track the request and resulting work.

• Where: Story cards are seen on Kanban boards.

8Wednesday, January 23, 13

The best time to record a user story is when it is first suggested.

However, that may be in the middle of a busy meeting.The best thing to do is make a note, and then, follow-up as soon as you can.

User Story What, When, Where, Why, Who

• What: Short description of a want/need.

• When: Someone (?) thinks of a new feature.

• Who: The “business” prioritizes requests.

• Why: Track the request and resulting work.

• Where: Story cards are seen on Kanban boards.

9Wednesday, January 23, 13

The business is responsible for providing priorities.

When there are several business stakeholders with differing priorities, you need a way to sort things out. Use a long table or wall where the business representatives can sequence the stories from low value to high value so that the highest value stories can be worked soonest.

Business prioritizes user stories in the backlog.

10Wednesday, January 23, 13

User Story What, When, Where, Why, Who

• What: Short description of a want/need.

• When: Someone (?) thinks of a new feature.

• Who: The “business” prioritizes requests.

• Why: Track the request and resulting work.

• Where: Story cards are seen on Kanban boards.

11Wednesday, January 23, 13

User stories provide a way to capture feature requests in a reasonably clear style.

Once captured you can use any requirements management system.But, most agile folks prefer Kanban boards.

User Story What, When, Where, Why, Who

• What: Short description of a want/need.

• When: Someone (?) thinks of a new feature.

• Who: The “business” prioritizes requests.

• Why: Track the request and resulting work.

• Where: Story cards are seen on Kanban boards.

12Wednesday, January 23, 13

13Wednesday, January 23, 13

Kanban boards are where user stories live.

Here are several so you can get an idea of the variety.

14Wednesday, January 23, 13

This one has “To Do”, “Doing”, and “Done”.Note that someone has crossed out “Done” and written in “Accept” to indicate the the work is not really done until is has passed acceptance.

Kanban Board

15Wednesday, January 23, 13

This is an electronic Kanban Board.

It is available on the web from: “leankit.com” for a reasonable annual subscription.

Kanban for Backlog

16Wednesday, January 23, 13

You will probably need two kanban boards: one for managing the backlogandone for managing the work in progress.

This example shows someone`s process for working the backlog.

Work In Progress View

Above the line: Components being worked today.Below the line: Components waiting for next phase.

Practice Just In Time Analysis and Design

A deployable feature mayrequire several components

Review

17Wednesday, January 23, 13

This example shows a fairly typical software life-cycle.Analyze, Design, Build, Deploy, Review.

One of the key ideas behind Kanban is that it is a pull-system, not a push system.If you push stories into the work-in-progress and then you don’t work them,you are increasing their cycle time and causing waste.

Accordingly, Analysis and Design needs to be done “just in time,” and not before, to avoid having stories sitting around in inventory gathering dust.

Identify Bottleneck

18Wednesday, January 23, 13

http://ketiljensen.wordpress.com/2009/10/31/kanban-the-next-step-in-the-agile-evolution/

Kanban boards also provide a way to spot bottlenecks in your workflow.

Notice that there is currently nothing in Acceptance Test but three items waiting.There could be a good reason. For example, the acceptance test might not make sense until an entire releasable feature has been assembled. But this situation requires some attention.

The bottleneck might be that your team has a bottleneck around acceptances testing.I’ve seen situations where a team could not run acceptance even though the product was otherwise believed to be ready for release.

To release this bottleneck, the team may need to move some resources from development and into test.

User Story Workshop

Scenario: A legislature has decided that it wants to balance the budget.

Each legislator will be issued shares of each kind of revenue to be allocated to investments and expenses.

Workshop: Write user stories for this.

19Wednesday, January 23, 13

Okay, this is where my talk gets tested.

We will see if I’ve been sufficiently clear,and you will get a chance to try the user story technique.

User Story Template

As a <role / persona>,I need / want a <capability>so that . . . <some benefit>

20Wednesday, January 23, 13

Details, Details, et cetera

Use Case DiagramsUse Case Documents

Given When Then - Clarifies ThinkingGiven When Then - Testable Requirements

21Wednesday, January 23, 13

Now I will talk about ways to document the details.

Use Case Diagram

22Wednesday, January 23, 13

A use case diagram is used to outline the situations where the system interacts with various other actors. The actors are usually humans, but may be other systems or subsystems.The egg shapes represent business tasks and are called “use cases”.

Use Case Diagram

23Wednesday, January 23, 13

This use case diagram shows how various tasks are related.If may also be used to break down a task into its subtasks.

24Wednesday, January 23, 13

Use case diagrams can provide a “big picture” view.The colors might represent anything you want -- for example: What has been built so far.

Use Case Document

Title: (Identify the situation or end-use.)

Preconditions: (Specify context. “Given”)

Scenario: (Describe interaction / steps. “When-Then”)

Post Conditions: (Expected effects. “Then”)

Business Rules: (Identify policy constraints.)

25Wednesday, January 23, 13

The use cases may be documented using a standard format.A diagram by itself is just a stage prop.Every node on a diagram should be documented before it can be considered an real design document.

WhoWhatWhenWhereWhy

-but notHow

26Wednesday, January 23, 13

User stories and use cases describe what the business wants.But you should avoid trying to include design advice about how a feature should be built in use cases and user stories.

From Story to Requirements

27Wednesday, January 23, 13

People tend to use the words “feature” and “requirement” as synonyms. Some will say that a business requirement is fulfilled by building features.Others will say that a feature must be build to meet certain business and technical requirements.

I will go with the feature has requirements point of view.

The Given-When-Then style of writing requirements clarifies thinking.

"Given" defines the preconditions that hold before an event or operation.

• "When" identifies an event or operation

• "Then" identifies the post conditions that hold after the event or operation.

28Wednesday, January 23, 13

Given-When-Then is often the best way to identify the business and technical requirements.

This format tends to produce requirements that are clear to both the business and the engineers.It also may lead directly to an automated test.

We can apply Given-When-Then at three levels of requirements writing to document intended

1. business events (business behavior) involved at the highest level (organization/user actor)

2. user interface for business process proxies

3. code behavior at the unit-test level (robot actor).

29Wednesday, January 23, 13

You can use Given-When-Then at three levels of thinking.

At the highest level, you can use Given-When-Then to identify business events.At the user interface level, you can use Given-When-Then to identify user interface behavior.At the level of unit tests, you can use Given-When-Then to specify the behavior of components.In fact, there are test libraries that enable the programmer to write unit tests in this format.

Business Process Level:

Given:[business goal / strategy]

When: [business activity / event]

Then: [desired business behavior]

(This can be tested by a process audit.)

30Wednesday, January 23, 13

At the business process level your Given might be a goal, a strategy, or a prior business event.

The When might be an activity or a business event.

The Then will typically be a desired business behavior.

You cannot really write this kind of thing into software.More likely, it would be written into a procedure or policy manual.Since it is not software, the test will be some kind of process audit.The process auditor will observe the business unit in action and decide if the desired behavior is present and adequate.

User Interface Level:

Given: [user-interface context / mode]

When: [user action]

Then: [system response]

(This can be tested through the UI. )

31Wednesday, January 23, 13

At the user interface level,the Given will probably indicate the user-interface context or mode.

The When will almost always be a user action, but it could be triggered by some other signal.

The Then will be a system response. Generally the system response will be visible in the user interface.

Robot / Computer Level:

Given: [system state]

When: [system event / input / additional state ]

Then: [expected system post-condition]

(This can be automated via xUnit framework.)

32Wednesday, January 23, 13

At the level of the robot or computer,the Given will specify the system state.

The When statements provide additional state, or identify an event or input.

The Given and When specify preconditions.The Then statements specify the resulting post-conditions.

In an automated test, the code under the Given will create that state.The code under When will cause the event, provide the input, or set additional state.The code under Then contains the test`s assertions.

At the business process level, our focus is on describing the business context of a set of requirements.

Given: The survey (ballot) is published (on-line); and, the survey (voting) period is in-progress.

When: A respondent (voter) enters a vote on a ballot item.

Then: That vote is tallied.

Then: The vote is secret. (It can be authenticated. But, it cannot be traced.)

Then: The voter can audit (verify that their entry is in the collection).

33Wednesday, January 23, 13

Here is an example using Given-When-Then to describe some business requirements.

Note that these descriptions indicate what is wanted without specifying how it is to be accomplished.

The interface level requirement identifies the interaction between actors. Typically, one actor is a user and the second actor is the system. (In an Enterprise Integration scenario, it might be two robots.)

Given: The user is signed-in and authenticated and has navigated to the survey (ballot) panel.

When: Some question is a proposal.

Then: The allowed responses are Yes, No, and Abstain. Abstain is the default value.

34Wednesday, January 23, 13

When you specify any kind of interface, you are, by definitionspecifying the interaction between actors.

A user interface involves two actors, the user and the system.But you can use this same procedure to specify a protocol between robots.( between two computer systems ).

But we cannot write an automated test without knowing a great deal about the design. However, the design can be indicated with Given-When-Then also.

Given: A ballot or survey represented in XML.

When: The ballot contains a proposal.

Then: The XML representation includes the pattern:"<proposal>text</proposal>".

Then: The interface-builder (component) will generate user interface code (HTML)

from the XML.

35Wednesday, January 23, 13

You can also represent some design ideas using Given-When-Then.

As a business analyst, I am sometimes asked to record design decisionsas part of the requirements documentation.Given-When-Then provides a style that adds clarity and can sometimes make design ideas testable.

At this point, a competent programmer can write code. The executable test might look like this (Smalltalk):

test1234ballotProposalXMLGeneratesHTML "The allowed responses for a proposal are Yes, No, and Abstain." | ballot ballotElement proposalElement html | self given: [ ballot := XML element: 'ballot' with: [ XML element: 'proposal' with: ['proposal text']. ]. "configuration comes from setUp" builder := configuration interfaceBuilder. ] when: [ ballotElement := ballot nextElement. proposalElement := ballotElement content at: 1. self assert: ( proposalElement isTag: 'proposal' ). html := builder buildHTMLfrom: proposalElement. ] then: [ self assert: ( html includes: 'Yes' ). self assert: ( html includes: 'No' ). self assert: ( html includes: 'Abstain' ). ].

36Wednesday, January 23, 13

This is Smalltalk code.It is the Smalltalk equivalent of the Given-When-Then we saw on the prior slide.

Given-When-Then clarifies thinkingbecause . . .

37Wednesday, January 23, 13

In summary, using the Given-When-Then format for requirements writingtends to clarify your thinking and make the requirements more testable because . . .

GIVEN WHEN THENCLARIFIES THINKING Given clause makes context and assumptions more explicit.

When clause indicates when/where new behavior is expected.

Then clauses indicate expected results (actions / end-states).

38Wednesday, January 23, 13

The Given statement makes the context and assumptions of the test more explicit.

The When statement indicates a triggering condition or additional context where the expected result is expected.

The Then clause contains the tests - the expected actions or end-states.

Given-When-Then Workshop

Write a few Given-When-Then cards (stickies) for one of your user stories.

Hints:

What might the technical requirements include?

What might other stakeholders require?

What might the acceptance tests include?

39Wednesday, January 23, 13

For this workshop write some Given-When-Then cards for the user stories you wrote in the first workshop.

Think about what the technical requirements might be.Consider what other stakeholders such as audit or information security or operations might require.Consider what the acceptance tests might include.

GitHub Resources

• https://github.com/RichardAlexanderGreen/GivenWhenThen

• See also:

• https://github.com/KentBeck/TDD-Tyrant

• https://github.com/pivotal/jasmine

40Wednesday, January 23, 13

Here are some additional resources that I am willing to recommend.

Slideshare Resources

• Godfrey Nolan: “Executable Requirements” http://www.slideshare.net/godfreynolan/net-executable-requirements

• Antonia Marcano: “BDD - beyond: Given, When, Then”http://www.slideshare.net/RiverGlide/bdd-beyond-given-when-then

• Louis Afredo Porras Paez: “BDD for JavaScript”http://www.slideshare.net/lporras161/jasmine-bdd-for-javascript

• Nickolay Vasilov: “Behavior Driven Development with Java”http://www.slideshare.net/shadrik/bdd-with-java-8323915

41Wednesday, January 23, 13

These are some additional presentations on the “slideshare.net” web site.

Questionsand

Answers-

Maybe

42Wednesday, January 23, 13