What is a user story and how to write one?

What is a user story?

A user story captures the requirements of a system from the perspective of the end user in agile software development.It is written in terms of end user to convey who the user is, what they want to achieve and why they want to achieve it. It is a simple and summarized description of a feature or part of a feature that once accomplished would provide some benefit to the end user.

User stories fill the gap between the high level requirements of a feature and what actually needs to be developed by the engineering team. By defining it in terms of end user, it helps in bringing the design, engineering and quality assurance team on the same page and think from the perspective of the end user and their needs.

Here is a simple template to write a user story:

“As a [type of user], I want [an action or feature], so that [a reason or benefit].”

Lets look at an example of a user story written for a social media app:

“As a registered user, I want to be able to post comments on other users’ posts, so that I can engage in conversations and share my thoughts.”

In this example, the end user is a registered user, the action or feature is the ability to post comments, and the reason or benefit is to engage in conversations and share thoughts.

When writing user stories, it’s important to focus on the user’s needs, keep them concise and specific, and avoid going into implementation details. User stories serve as a basis for communication between the development team and stakeholders, helping to prioritize and plan the work effectively.

What are characteristics of a user story?

An ideal user story must follow INVEST acronym:

  1. Independent: The user story should be self-contained and independent of other stories.
  2. Negotiable: The details and implementation of the user story can be negotiated between the development team and the product owner.
  3. Valuable: The user story should bring value to the end user or customer.
  4. Estimable: The development team should be able to estimate the effort required to complete the user story.
  5. Small: User stories should be small enough to be completed within a single iteration or sprint.
  6. Testable: The user story should have clear acceptance criteria that can be used to verify its completion.

Role of product owner in writing user stories

The product owner plays a crucial role in writing user stories. They are responsible for understanding and representing the needs of the users, customers, and stakeholders throughout the development process. Here are some specific roles and responsibilities of the product owner in writing user stories:

  1. Gathering Requirements:

The product owner works closely with stakeholders, users, and customers to identify their requirements, needs, and expectations. They engage in conversations, conduct interviews, and gather feedback to gain a deep understanding of what the users want.

  1. Defining User Personas:

    User personas represent the different types of users or customers who will be using the product. The product owner helps create these personas by considering demographics, behaviors, goals, and motivations. These personas serve as a reference point when writing user stories.

  2. Prioritizing Features:


    The product owner collaborates with the development team and stakeholders to prioritize features and functionalities. They consider the value, impact, and feasibility of each user story, ensuring that the most important and valuable stories are written and implemented first.

  3. Writing User Stories:

    Based on the gathered requirements and user personas, the product owner takes the lead in writing user stories. They use the “As a [type of user], I want [an action or feature], so that [a reason or benefit]” format to capture the essence of the user’s needs and expectations.

  4. Communicating with the Development Team:

    The product owner/manager acts as a liaison between the development team and the stakeholders. They clarify the user stories, answer questions, and provide additional context to ensure a shared understanding of the requirements. They also work with the team to break down user stories into smaller, actionable tasks.

  5. Defining Acceptance Criteria:

    The product owner collaborates with the development team to define clear acceptance criteria for each user story. These criteria outline the specific conditions and outcomes that must be met for the user story to be considered complete. They help ensure that the development team delivers the desired functionality.

  6. Iterative Refinement:

    Throughout the development process, the product owner continuously reviews and refines user stories based on feedback, changing priorities, and evolving user needs. They incorporate new insights and adjust the user stories to maximize value and meet customer expectations.

Overall, the product owner acts as an advocate for the users, ensuring that their needs and expectations are accurately captured in the user stories. They collaborate with stakeholders and the development team to create a shared vision and guide the development process towards delivering a valuable and successful product.

How to write a user story using Gherkin format?

To write a user story using the Gherkin format, follow these steps:

  1. Start with the Feature:

    Begin the user story by specifying the feature or functionality you are describing. This sets the context for the user story.

  2. Write the Scenario:

    Each user story can have multiple scenarios. Start by writing a scenario that describes a specific situation or condition in which the user interacts with the system. Begin the scenario with the “Scenario” keyword, followed by a descriptive title.

  3. Add Given, When, and Then Steps:

    Within the scenario, use the Given, When, and Then steps to outline the specific actions and expected outcomes. Here’s how to structure these steps:

    • Given: Describe the initial setup or preconditions for the scenario.
    • When: Specify the action or event that the user performs.
    • Then: Define the expected outcome or result of the action.

    Each step should begin with the keywords “Given,” “When,” or “Then” followed by a statement. For example:

    sql
    Given the user is logged into the system
    When the user clicks on the "Add to Cart" button
    Then the item should be added to the shopping cart
  4. Add Additional Scenarios

    : If the user story has multiple scenarios, add them under the same feature. Each scenario should follow the same Given, When, Then format.

  5. Include Example Tables (Optional)

    If your scenario involves multiple data inputs or variations, you can use example tables to provide clear and concise examples. This can be done using the pipe character (|) to separate values within a table. For example:

    sql

    Scenario: Search for a product
    Given the user is on the homepage
    When the user searches for the following products:
    | Product |
    | Phone |
    | Headphones |
    Then the search results should display the products
  6. Repeat for Each User Story:

    Follow the same structure for each user story, describing the features, scenarios, and steps specific to that user story.

By following the Gherkin format, you can create user stories that are not only readable by stakeholders but also serve as executable specifications for automated testing. It promotes collaboration and clarity between the development team and stakeholders, allowing for better understanding and validation of requirements. You can read more about Gherkin format here to get a deeper understanding on how to use this format for user stories.

Mistakes to avoid in user stories

When writing user stories, it’s important to avoid certain mistakes to ensure their effectiveness and clarity. Here are some common mistakes to avoid:

  1. Including Implementation Details:

    User stories should focus on the user’s needs and desired outcomes, rather than prescribing specific implementation details. Avoid getting into technical specifics or solutions within the user story itself.

  2. Writing Vague or Ambiguous Stories:

    User stories should be clear and specific, leaving no room for ambiguity. Avoid using vague language or generalized statements that can lead to different interpretations. Provide enough details for the development team to understand the user’s intent.

  3. Neglecting Acceptance Criteria:

    Acceptance criteria are crucial for defining the boundaries and success criteria of a user story. Neglecting to include acceptance criteria can lead to misunderstandings and challenges during development. Clearly specify the conditions that must be met for the user story to be considered complete.

  4. Overlooking User Value:

    User stories should prioritize the value and benefits to the user. Avoid writing stories that don’t bring significant value or are not aligned with user needs. Focus on the most valuable features and functionalities that address real user problems or enhance their experience.

  5. Forgetting Non-Functional Requirements:

    User stories often emphasize functional requirements, but non-functional requirements (such as performance, security, or scalability) are equally important. Don’t overlook these aspects when writing user stories to ensure a well-rounded understanding of the user’s expectations.

  6. Not Involving the Right Stakeholders:

    User stories require collaboration and input from various stakeholders, including users, customers, and the development team. Failing to involve the right stakeholders can result in incomplete or inaccurate user stories. Engage with all relevant parties to gain a comprehensive understanding of the requirements.

  7. Ignoring User Feedback:

    User stories should be dynamic and subject to refinement based on user feedback. Avoid treating user stories as fixed and unchangeable. Continuously gather feedback and iterate on the user stories to ensure they remain aligned with evolving user needs and priorities.

  8. Overcomplicating or Underestimating Stories:

    User stories should be sized appropriately to ensure they can be completed within a reasonable timeframe. Avoid creating overly complex or large user stories that may be difficult to estimate or complete within a single iteration. Break down large stories into smaller, more manageable pieces.

By avoiding these common mistakes, you can write user stories that are clear, valuable, and aligned with user needs, facilitating effective communication and successful development.

About monica

Monica, has an extensive experience in launching products across various platforms in healthcare, media and ed-tech domain. She loves to share her thoughts on product management based on her experience.

3 thoughts on “What is a user story and how to write one?”

  1. Pingback: Product Discovery

Leave a Comment