• Home
  • Blog
  • Write Test Cases from User Stories and Manage Tests with JIRA

In the Agile software development process, where user stories play a pivotal role in defining requirements, writing effective test cases is crucial for ensuring the quality of software. Test cases derived from user stories help validate that the developed features meet the user’s expectations. This tutorial will guide beginner QA engineers, test engineers, and QA consultants on writing test cases based on user stories with a focus on Use Case Testing.

What is a User Story?

A user story is a succinct and informal narrative that encapsulates a specific feature from the viewpoint of an end user. It serves as a fundamental component of Agile development, fostering collaboration and understanding between stakeholders. The structure of a user story typically consists of key elements that convey essential information.

Structure of a User Story:

Title: The user story begins with a clear and descriptive title that succinctly conveys the essence of the feature.

Actor (As a): Identifies the role or persona interacting with the system. This clarifies who will benefit from or utilize the described functionality.

Action (I want to): Describes the desired action or functionality the user is seeking. This component outlines the specific user goal or objective.

Benefit (So that): Articulates the intended benefit or value that the user expects to gain from the described functionality. This ensures alignment with overall project goals.

Example of a User Story (Login Functionality):

Title: User Login

As a registered user of MyApp,

I want to be able to log in with my credentials,

So that I can access personalized features and information.

Acceptance Criteria:

Given that I am on the login page,

When I enter my valid username and password,
And click on the login button,
Then I should be redirected to the home page.

Given that I am on the home page after successful login,

When I log out,
Then I should be redirected to the login page.

What is a Test Case?

A test case is a detailed set of conditions and instructions meticulously crafted to verify whether a specific functionality operates as expected. It serves as a vital component of the testing process, providing a systematic approach to ensure the reliability and correctness of software features.

Structure of a Test Case:

A typical test case comprises several essential elements to effectively communicate the testing process. Here’s a brief overview of the common structure:

1. Test Case ID: Assign a unique identifier to distinguish the test case from others. This helps in tracking and referencing during the testing phase.

2. Description: Provide a concise and clear description of the purpose of the test case. This serves as a quick reference to understand the goal of the test.

3. Preconditions: Specify the necessary conditions that must be fulfilled before executing the test case. This ensures a consistent starting point for the test.

4. Test Steps: Outline a step-by-step sequence of actions to be performed during the test. Each step should be specific, unambiguous, and contribute to achieving the test objectives.

5. Expected Results: Clearly define the expected outcomes or behavior at the end of the test. This acts as a benchmark for evaluating the actual results obtained during test execution.

6. Actual Results: Record the observed outcomes during the execution of the test case. Any discrepancies or deviations from the expected results should be documented here.

7. Notes: Include any additional information or observations that might be relevant to the test execution. This section provides a space for testers to document noteworthy details.

8. Attachments: If applicable, attach supporting evidence such as screenshots, logs, or files to provide a comprehensive view of the test execution.

9. Defects (if any): In the event of a test failure, log details of the defect in the defect tracking system. Include information on the nature of the issue, steps to reproduce, and any relevant context.

By adhering to a structured format, a test case becomes a powerful tool for quality assurance, facilitating effective communication among team members and ensuring a thorough and consistent testing process.

Transforming a User Story into a Practical Test Case

Now, let’s delve into the process of transforming a user story, specifically the user story for the Login Functionality we wrote above, into a practical test case. This process ensures a thorough validation of the software functionality from the user’s perspective, allowing us to rigorously test and confirm that the application meets the specified requirements.

User Story written for the Login Functionality :

Image of a User Story written for a simple Login Functionality

From the above user story, let’s identify the main functionalities: user login and logout. Next, we’ll create two straightforward and detailed test cases to thoroughly test the Login functionality.

Extracted Main Functionalities:

  1. User Logs In:
    • Input valid login credentials.
    • Click on the “Login” button.
    • Verify successful redirection to the home page.
  2. User Logs Out:
    • Click on the “Logout” link or button.
    • Verify successful redirection to the login page.

Test Case: Verify User Login Functionality

Here is the detailed test case for the login functionality, derived directly from the user story we discussed earlier.

Test Case ID: TC_Login_001

Description: Verify that a registered user can log in to the MyApp application.

Preconditions:
1. The MyApp application is accessible.
2. The user has a registered account with valid login credentials.

Test Steps:
1. Open the MyApp Application:
   - Navigate to the URL of the MyApp application.

2. Navigate to the Login Page:
   - Click on the 'Login' link or button to access the login page.

3. Enter Valid Credentials:
   - Input valid login credentials (username and password) in the respective fields.
     - Username: [ValidUsername]
     - Password: [ValidPassword]

4. Click on the Login Button:
   - Click on the 'Login' button to submit the login form.

5. Verify Successful Login:
   - After clicking the login button, verify that the user is successfully redirected to the home page.
   - Check for any welcome messages or user-specific content indicating a successful login.

Expected Results:
1. The user should be able to log in successfully.
2. After successful login, the user should be redirected to the home page.
3. Any relevant user-specific information or messages should be visible to indicate a successful login.

Actual Results:
Record the actual outcomes observed during test execution, including any discrepancies or issues encountered.

Notes:
Document any additional information or observations during the test execution.

Attachments:
Attach screenshots or logs as evidence of the test execution.

Defects (if any):
If the test fails, log a defect in the defect tracking system with detailed information.

Test Case: Verify User Logout Functionality

Below is the comprehensive test case for the logout functionality, directly derived from the user story we previously examined

Test Case ID: TC_Logout_002

Description: Verify that a registered user can log out of the MyApp application.

Preconditions:
1. The MyApp application is accessible.
2. The user is logged in with valid credentials.

Test Steps:
1. Navigate to the Logout Option:
   - Ensure the user is currently logged in.
   - Locate and click on the 'Logout' link or button.

2. Verify Successful Logout:
   - After logging out, verify that the user is redirected to the login page.
   - Check for any confirmation messages or elements indicating a successful logout.

Expected Results:
1. The user should be able to log out successfully.
2. After logging out, the user should be redirected to the login page.

Actual Results:
Record the actual outcomes observed during test execution, including any discrepancies or issues encountered.

Notes:
Document any additional information or observations during the test execution.

Attachments:
Attach screenshots or logs as evidence of the test execution.

Defects (if any):
If the test fails, log a defect in the defect tracking system with detailed information.

Thus, this is how you write test cases derived from a given user story, ensuring the software application meets user expectations and maintains reliability in the Agile development process. I hope you now have a basic and good understanding of how to create effective test cases.

Let’s move on to exploring how these test cases can be managed in a test management tool, specifically JIRA. In this article, I will elaborate on the process of writing and organizing test cases using JIRA.

Why Use JIRA for Test Management:

JIRA, primarily known as an issue tracking and project management tool, is often employed for test case management in Agile development. Here are some advantages of using JIRA for this purpose:

1. Integration with Development Workflow: JIRA seamlessly integrates with Agile methodologies, linking test cases to user stories, tasks, and other issues for a cohesive connection between development and testing.

2. Customization and Flexibility: Highly customizable, JIRA allows teams to define custom fields, workflows, and issue types, tailoring the tool to specific testing processes and needs.

3. Visibility and Collaboration: Providing visibility into the testing process, JIRA supports collaboration with features such as commenting on test cases, attaching files, and facilitating communication within the platform.

4. Integration with Test Case Management Plugins: JIRA’s plugins like Zephyr and Xray enhance its capabilities, offering features like test case creation, execution, and reporting within the Jira environment.

5. Traceability: Enabling traceability, JIRA links test cases to related user stories or requirements, aiding in understanding test case coverage and alignment with project goals.

6. Search and Reporting: JIRA’s search and reporting features allow the creation of customized filters and reports on test case execution, status, and progress, facilitating effective tracking and trend identification.

7. Ease of Use for Non-Technical Users: With a user-friendly interface, JIRA is accessible to both technical and non-technical team members, enabling testers to create and manage test cases without extensive technical expertise.

While JIRA is widely liked for its flexibility, ability to work with other tools, and teamwork features, it’s important to check if it really suits your team’s needs. Make sure to think about your team’s unique requirements and decide if JIRA, maybe with some extra plugins, is the right fit for how you test things.

Using JIRA to Write Test Cases from User Stories

Jira’s versatility extends beyond test case management; it is often used to create and manage user stories. Leveraging the same platform for generating and attaching test cases streamlines the process, promoting efficiency and consistency in project management.

Now, let’s delve into the structured approach of creating a test case using Jira, aligning it with a user story:

1. Create a User Story:
Begin by creating a user story in Jira, specifying the actor, action, and benefit, along with acceptance criteria.

2. Link User Story to Test Case:
Utilize Jira’s linking feature to associate the created user story with the corresponding test case. This ensures traceability and a clear connection between requirements and test coverage.

3. Navigate to Test Case Section:
In Jira, navigate to the test case management section or utilize a plugin like Zephyr or Xray to access dedicated test case functionalities.

4. Create a Test Case:
Within the test case management section, create a new test case. Reference the linked user story and populate the test case with relevant details such as description, preconditions, test steps, and expected results.

5. Attach Screenshots or Files:
Enhance the test case by attaching any necessary files, screenshots, or documentation that provide additional context for the testers.

6. Execute and Track in Jira:
As testing progresses, execute the test case directly within Jira or through integration with test execution tools. Record actual results and any notes during the testing phase.

7. Link Defects (if any):
In case of test failures, link any identified defects to the corresponding test case. This ensures a streamlined process for defect tracking and resolution.

By utilizing Jira for both user story creation and test case management, teams can enjoy a unified platform that enhances collaboration, traceability, and overall project efficiency.

Conclusion

In this tutorial, we learned how user stories guide software development, and test cases ensure everything works as it should. We transformed a user story into a detailed test case, and explored how integrating JIRA as a test management hub enhances efficiency and collaboration. If you’re seeking further insights into refining your testing process, consider reaching out to a software consultant. The consultants at SLC are available to provide assistance and guidance.

Posted on November 28, 2023

Ishara Amarasekera

With a passion for cutting-edge tech, I'm a Scrum-certified Software Engineer & Mobile App Developer. My expertise spans native & cross-platform mobile and web app development. A skilled collaborator & proven communicator, I love crafting creative solutions for global clients.

We'd love to hear from you

Our friendly team would love to hear from you.





    You may also like

    We share all our learnings and innovations so you can use them, improve on them and let us know too...

    Basics of Docker for Software Development

    Introduction to Docker

    Docker is a containerization platform that enables developers to package applications along with their dependencies i...

    Read more

    Selenium IDE: Beginner’s Guide to Initiating Automation

    What is Selenium IDE ?

    Selenium IDE is a popular open-source tool for...

    Read more

    Figma Fundamentals: A Beginner’s Guide to Designing UI

    Designing websites or apps might seem hard, but with Figma, it's as easy as using a pencil! Whether you're making a cool ...

    Read more