2

I've just started using SpecFlow. It's a tool for creating business understandable test scenarios in a BDD manner. Basically it transforms user stories to unit tests.

I'm a beginner to user stories and I wonder about its length. Is this a good practice to create very precise user stories? Here's an example:

In order to get help As a StackOverflow user I want to add post with name and content and add tags to it and format the content and the information about my post edits to be stored in the system and some more things like that 

Should I keep my stories compact? If so - how can I manage detailed requirements? Or maybe it's nothing wrong in very long and precise I want section in a user story?

3 Answers 3

3

If you could develop an entire system in a couple of weeks, and do that reliably, nobody would ever worry about "user stories". They'd just get you to develop the system, sit with you, and tweak it as it went.

User stories only exist in order to get feedback from people who can't be with you all the time, and to help you learn what it is that your users (and other stakeholders) really want.

Here's how I treat a list like this:

In order to get help As a StackOverflow user I want to add post with name and content and add tags to it and format the content and the information about my post edits to be stored in the system 

You want to get help. Which of these actually add to your ability to get help? Is it you wanting help, or do you want to offer help to other people? Do you want recognition for the help you're offering other people? The top part of this seems false (and it's why it's really difficult to have these conversations with fake requirements).

I think there are multiple requirements here, and far beyond the scope of just one user story. With an analyst hat on, here's how I might break this down:

In order to award great content with appropriate recognition, as Stack Exchange, we want people's usernames to appear with their content. 

Of course, the users want this too, but they're not paying for it (except through adverts). So work out who's paying for this, and why.

In order to get more page impressions and keep people on the site for longer, as Stack Exchange, we want users to be able to find similar content really easily. 

Hm. This one's a bit trickier. See, the user doesn't really want to spend their entire life on StackOverflow. It's just that if we give them the appropriate recognition, and make it easier for others to find their content, they might do that. Not all "user stories" actually benefit users. Find out who's paying for them, and why; then you find your real stakeholder. It's also OK for a story to benefit more than one stakeholder, and it's easy to see how to rephrase this from the user's point of view as well.

format the content 

Honestly not sure about this one. It might be about being able to emphasise important points, etc. There are a ton of aesthetic ideals that don't lend themselves well to BDD and automated scenarios. Sometimes the only way to do this is to try, and get feedback.

In order to avoid retyping my request every time As the user I want the information about my post edits to be stored in the system 

Well, yes, that would be nice.

The thing is that each of these can be developed independently. If you can think of any feature, any item that you could get rid of and still have the release be valuable, put it in a separate story.

If you can replace "I want to..." with "I want to be able to..." it's likely that what you have there isn't a story, but an entire capability. Most people do this instinctively. Lots of people call those "epics".

I've just shown you how I break them down. It's a pretty simple process.

First, look at your requirements. If there's anything for which you can say, "I want to be able to..." or "Someone wants to be able to..." then you know that's a completely different capability, which means it's going to be a separate story.

You can then separate those into contexts. So you might have stories like:

In order to free up our junior traders We want them to be able to generate contracts automatically So that they can help with the trade analysis instead of typing. 

If that seems too big for the feedback cycle (typically a two-week sprint), you can divide it further.

In order to free up our junior traders We want them to be able to generate *orange juice* contracts automatically So that they can help with the trade analysis instead of typing. 

Here, we're focusing on being able to trade orange juice, but we could equally narrow the story down to the FTSE, or the US, or the NY stock exchange. This is how we focus the efforts on the thing that will deliver: protecting revenue, lowering costs or generating value.

To turn these into scenarios, I ask, "Can you give me an example of an OJ trade on the NY stock exchange?" If I see anything generic that I don't understand, I ask, "Can you give me an example of that?"

That example becomes my first scenario. The context (given) is defined by the limits of the story. The event (when) is the performance of the capability. The outcome (then) is the resulting value.

In answer to your question - yes, I think it's important to create precise user stories. That means knowing why it's valuable, defining the context that you're going to cover, and suggesting an example of what the outcome might be.

The example you gave is more than just one story, though. It's not precise enough. Hopefully the advice here will help you to narrow stories down to something useful. One or two days is a good length for a story, but if you're starting down this path and find they're a bit longer, that's OK.

Your changes are also stories.

Sign up to request clarification or add additional context in comments.

Comments

2

I always advise the following:

Try cutting your stories in scenarios. The more scenarios, the better you can pinpoint when something is going wrong. Give all scenarios subjective names.

Now for example, your test. If step 1 goes wrong, all your other steps are not going to get tested.

Also use the Given, When and Then tags to read your scenarios easily.

So instead, you could say:

Feature: As a StackOverflow user I want to add a post Scenario: I go to stackoverflow website Given I open the browser And I go to the stackoverflow website When I click New Post Then a new page appears to insert my data Scenario: I fill in data for my post - Name and content Given I do not modify this page When I fill in name And I fill in content Then I add tags to it And I format the content Scenario: Check if information about post edits are stored in the system Given... 

Guess you will get where this is going :-)

3 Comments

Okay, and what about precise definitions of for instance validation? If I have let's say form of three input boxes, first two are required, first is 50 char max, second 20 and third 100 - should I have all this information listed in the scenarios?
Yes, I would advise you that. Are you going to use Selenium with SpecFlow? Make your scenarios as detailed as possible. I once had a scenario (translated from dutch) which said: Scenario: User fills in values for monday 08:00 till 10:00, tuesday 08:00 till 12:00, wednesday 14:00 till 18:00 and sunday 09:00 till 12:00.
To be honest I'm just experimenting with SpecFlow and I'm not sure if I'm going to use it at all. At the moment I'm trying to build a domain model from stories, so my tests are not strict tests, I rather try to verify if I have all required data fields and proper contracts. Anyway adding such details obscures scenarios. I don't say it's unnecessary, but I'm not satisfied with the result...
1

There is no right detail level of user stories, as user stories shrink in size (scope) and grow in detail (specifications) over time. This slide shows a nice visualization from Gojko Adzic about this: http://www.slideshare.net/chassa/2015-0214agile-reqend2endcomplete/6

For the question on how precise and detailed a Gherkin scenario should be: Scenario should reveal interesting aspects of the user story to be implemented. They should use concrete (key) examples rather than abstract descriptions. The examples should focus on the aspect that should be illustrated. The scenario title should be an abstract description of the rule or aspect that is illustrated with the example(s) provided in the scenario.

You usually start with a main aspect (happy path) scenario, and then try to “break the model” by coming up with new examples (cases) that explore other aspects of the story. You start by asking the questions “How would you try out the story when it was implemented?” (happy path) and “What should happen if …?” to collect potential scenarios to consider (probably defining some of the questions to be out of scope for this story).

After that, you’re trying to answer these questions (scenario title) and illustrate them with concrete examples (scenario steps). This slide gives an idea of “break the model”: http://www.slideshare.net/chassa/2015-0214agile-reqend2endcomplete/61

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.