Lab 4 - Using Jira, Xray, and Zephyr for Software Testing and Scrum Practices


In this tutorial, I’ll guide you through using Jira, Xray, and Zephyr to manage software testing and practice Scrum in a team setting. We’ll build on the previous tutorials (unit, integration, and E2E testing) by incorporating Jira for Scrum practices and Xray/Zephyr for test management. The focus will be on preparing a product backlog, creating sprints, epics, stories, sub-tasks, bugs, and planning tests. We’ll use the same book management API (Spring Boot) and user management API (Express.js) as examples, extending them into a team-based Scrum workflow with testing integrated.


Overview

We’ll simulate a Scrum team working on two projects:

  1. Spring Boot Book Management API: A team building a REST API to manage books.
  2. Express.js User Management API: A team building a REST API to manage users.

We’ll use Jira to manage the Scrum process (product backlog, sprints, epics, stories, sub-tasks, bugs) and Xray/Zephyr to manage testing (test cases, test plans, test executions). The labs will provide hands-on experience in setting up and managing these processes.


Prerequisites

  • Jira Account: You need access to a Jira instance (Jira Cloud or Server/Data Center). You can sign up for a free trial on Atlassian’s website if you don’t have one.
  • Xray and Zephyr Installed:
    • Xray: Install Xray from the Atlassian Marketplace (available for Jira Cloud, Server, and Data Center). Xray adds issue types like Test, Test Set, Test Plan, and Test Execution.
    • Zephyr: Install Zephyr Scale (or Zephyr for Jira) from the Atlassian Marketplace. Zephyr also adds a Test issue type and supports test cycles.
  • Spring Boot and Express.js Projects: Use the projects from the previous tutorials (unit, integration, and E2E testing). Ensure both APIs are running:
    • Spring Boot API at http://localhost:8080/api/books.
    • Express.js API at http://localhost:3001/api/users.
  • Basic Understanding of Scrum: Familiarity with Scrum concepts like product backlog, sprints, epics, stories, and sub-tasks.

Part 1: Setting Up Jira for Scrum

Step 1: Create a Scrum Project in Jira

  1. Log in to Jira:
    • Log in to your Jira instance.
  2. Create a New Project:
    • Click on Projects > Create Project.
    • Select Scrum as the project template.
    • Choose Team-Managed Project for simplicity (or Company-Managed if you prefer more control).
    • Name the project Book Management Scrum (for the Spring Boot team) and set a key (e.g., BMS).
    • Repeat the process to create a second project called User Management Scrum (key: UMS) for the Express.js team.
  3. Access the Backlog:
    • Once the project is created, you’ll land on the Backlog view. This is where you’ll manage the product backlog, sprints, and issues.

Step 2: Build the Product Backlog

The product backlog is a prioritized list of work items (issues) for the project. In Jira, these are represented as issues (e.g., Epics, Stories, Tasks, Bugs).

  1. Create Epics:

    • In the Book Management Scrum project, go to the Backlog view.
    • On the left sidebar, find the Epics panel and click Create Epic.
    • Add the following epics:
      • Epic Name: Book CRUD Operations
        • Description: “As a user, I want to perform CRUD operations on books so that I can manage the book catalog.”
      • Epic Name: Book Search Functionality
        • Description: “As a user, I want to search for books by title or author to find them quickly.”
    • Repeat for the User Management Scrum project:
      • Epic Name: User CRUD Operations
        • Description: “As a user, I want to perform CRUD operations on users so that I can manage user accounts.”
      • Epic Name: User Authentication
        • Description: “As a user, I want to log in securely to access the system.”
  2. Create User Stories:

    • In the Backlog view, click Create Issue (or press C on your keyboard).
    • For the Book Management Scrum project, create the following stories under the Book CRUD Operations epic:
      • Story: Add a New Book
        • Summary: “As a librarian, I want to add a new book to the catalog so that it’s available for users.”
        • Issue Type: Story
        • Epic Link: Book CRUD Operations
        • Story Points: 3 (an estimate of effort/complexity)
      • Story: View All Books
        • Summary: “As a user, I want to view all books in the catalog to browse available titles.”
        • Issue Type: Story
        • Epic Link: Book CRUD Operations
        • Story Points: 2
    • For the User Management Scrum project, create stories under the User CRUD Operations epic:
      • Story: Add a New User
        • Summary: “As an admin, I want to add a new user to the system so they can access it.”
        • Issue Type: Story
        • Epic Link: User CRUD Operations
        • Story Points: 3
      • Story: View All Users
        • Summary: “As an admin, I want to view all users in the system to manage accounts.”
        • Issue Type: Story
        • Epic Link: User CRUD Operations
        • Story Points: 2
  3. Prioritize the Backlog:

    • In the Backlog view, drag and drop the stories to prioritize them. For example, prioritize Add a New Book above View All Books in the Book Management Scrum project.

Step 3: Create Sub-Tasks

Sub-tasks break down stories into smaller, actionable pieces of work.

  1. Add Sub-Tasks to a Story:
    • In the Book Management Scrum project, open the Add a New Book story.
    • Click Create Sub-Task (or the + icon under the story).
    • Add the following sub-tasks:
      • Sub-Task: Implement POST Endpoint
        • Summary: “Implement the POST /api/books endpoint to add a new book.”
        • Issue Type: Sub-Task
      • Sub-Task: Validate Input Data
        • Summary: “Add validation for book title and author in the POST endpoint.”
        • Issue Type: Sub-Task
    • Repeat for the Add a New User story in the User Management Scrum project:
      • Sub-Task: Implement POST Endpoint
        • Summary: “Implement the POST /api/users endpoint to add a new user.”
      • Sub-Task: Validate User Input
        • Summary: “Add validation for user name and email in the POST endpoint.”

Step 4: Plan a Sprint

  1. Create a Sprint:

    • In the Backlog view of the Book Management Scrum project, click Create Sprint at the top of the backlog.
    • Name the sprint Sprint 1 - Book CRUD and set the duration to 2 weeks (e.g., April 3, 2025, to April 17, 2025).
    • Repeat for the User Management Scrum project, naming the sprint Sprint 1 - User CRUD.
  2. Add Stories to the Sprint:

    • Drag the Add a New Book and View All Books stories into Sprint 1 - Book CRUD in the Book Management Scrum project.
    • Drag the Add a New User and View All Users stories into Sprint 1 - User CRUD in the User Management Scrum project.
  3. Start the Sprint:

    • Click Start Sprint for Sprint 1 - Book CRUD. Set the sprint goal as “Implement basic CRUD operations for books.”
    • Repeat for Sprint 1 - User CRUD with the goal “Implement basic CRUD operations for users.”

Part 2: Test Planning with Xray

Step 1: Set Up Xray for Test Management

Xray uses Jira issue types (Test, Test Set, Test Plan, Test Execution) to manage testing. We’ll create test cases for the stories in our sprints and plan their execution.

  1. Create Test Cases:

    • In the Book Management Scrum project, click Create (or press C).
    • Select Issue Type as Test (added by Xray).
    • Create a test case for the Add a New Book story:
      • Summary: “Test adding a new book with valid data”
      • Description: “Verify that a new book can be added to the catalog.”
      • Test Type: Manual
      • Steps:
        1. Send a POST request to /api/books with valid title and author.
        2. Verify the response status is 200.
        3. Verify the book is added to the database.
      • Expected Result: The book is successfully added, and the response contains the book details.
      • Link to Story: Add a New Book (use the “Link Issue” field to associate the test with the story).
    • Create another test case for the View All Books story:
      • Summary: “Test viewing all books in the catalog”
      • Description: “Verify that all books are returned when requesting the book list.”
      • Test Type: Manual
      • Steps:
        1. Send a GET request to /api/books.
        2. Verify the response status is 200.
        3. Verify the response contains a list of all books.
      • Expected Result: The response contains all books in the database.
      • Link to Story: View All Books
    • Repeat for the User Management Scrum project, creating test cases for Add a New User and View All Users.
  2. Organize Tests into a Test Set:

    • Click Create and select Issue Type as Test Set.
    • Summary: “Book CRUD Test Set”
    • Add the two test cases created above to this test set by linking them (use the “Add Tests” option in Xray).
    • Repeat for the User Management Scrum project, creating a User CRUD Test Set.
  3. Create a Test Plan:

    • Click Create and select Issue Type as Test Plan.
    • Summary: “Sprint 1 Book CRUD Test Plan”
    • Link the Book CRUD Test Set to this test plan.
    • Assign the test plan to Sprint 1 - Book CRUD (use the Sprint custom field).
    • Repeat for the User Management Scrum project, creating a Sprint 1 User CRUD Test Plan.
  4. Create a Test Execution:

    • Click Create and select Issue Type as Test Execution.
    • Summary: “Sprint 1 Book CRUD Test Execution”
    • Link the test cases from the Book CRUD Test Set to this test execution.
    • Assign it to a team member for execution.
    • Repeat for the User Management Scrum project.

Step 2: Execute Tests and Log Bugs

  1. Execute Tests:

    • Open the Sprint 1 Book CRUD Test Execution issue.
    • For each test case, click Execute and follow the steps.
    • Mark the test as Passed or Failed. For example, if the Add a New Book test fails because the API returns a 500 error, mark it as Failed.
  2. Log a Bug:

    • If a test fails, create a bug directly from the test execution:
      • Click Create Defect in Xray.
      • Summary: “POST /api/books returns 500 error”
      • Issue Type: Bug
      • Description: “When sending a POST request to /api/books, the server returns a 500 error.”
      • Link to the test case and the Add a New Book story.
    • Assign the bug to a developer and add it to the current sprint.
  3. Track Progress:

    • Go to the Reports section in Xray (accessible from the project sidebar).
    • Generate a Test Execution Results Report to see the status of tests in the Sprint 1 Book CRUD Test Plan.
    • Share the report with stakeholders by exporting it as a PDF.

Part 3: Test Planning with Zephyr

Step 1: Set Up Zephyr for Test Management

Zephyr Scale (or Zephyr for Jira) also integrates with Jira and uses a Test issue type. We’ll create a regression test cycle for the sprint.

  1. Create Test Cases:

    • In the Book Management Scrum project, click Create and select Issue Type as Test (added by Zephyr).
    • Create a test case for the Add a New Book story:
      • Summary: “Test adding a new book with valid data”
      • Description: “Verify that a new book can be added to the catalog.”
      • Test Steps:
        1. Send a POST request to /api/books with valid title and author.
        2. Verify the response status is 200.
        3. Verify the book is added to the database.
      • Expected Result: The book is successfully added.
      • Link to Story: Add a New Book
    • Repeat for the View All Books story and for the User Management Scrum project.
  2. Create a Test Cycle:

    • In the Tests menu (added by Zephyr), select Create Test Cycle.
    • Name: “Sprint 1 Regression Cycle - Books”
    • Add the test cases created above to this cycle.
    • Assign the cycle to Sprint 1 - Book CRUD.
    • Repeat for the User Management Scrum project.
  3. Execute Tests and Log Bugs:

    • In the Tests menu, go to Execute Tests.
    • Select the Sprint 1 Regression Cycle - Books cycle and execute each test.
    • Mark the test as Passed or Failed. If a test fails, create a bug:
      • Summary: “GET /api/books does not return all books”
      • Issue Type: Bug
      • Link to the test case and the View All Books story.
  4. Track Progress:

    • In the Tests menu, go to Test Metrics.
    • View the execution status of the test cycle using a pie chart or graph.
    • Use the Test Summary to see the total tests executed and remaining.

Part 4: Managing the Sprint

Step 1: Monitor the Sprint

  1. View the Active Sprint:

    • In the Book Management Scrum project, go to Active Sprints.
    • You’ll see the stories, sub-tasks, and bugs in the sprint board (e.g., To Do, In Progress, Done).
    • Move issues across the board as the team progresses (e.g., move Implement POST Endpoint to In Progress when a developer starts working on it).
  2. Hold Daily Stand-Ups:

    • Use the sprint board to facilitate daily stand-ups. Team members can update the status of their issues and discuss blockers.

Step 2: Complete the Sprint

  1. Complete the Sprint:

    • At the end of the sprint (e.g., April 17, 2025), go to Active Sprints.
    • Click Complete Sprint.
    • Move any incomplete issues (e.g., unresolved bugs) to the backlog or the next sprint.
  2. Review Test Results:

    • Use Xray’s Test Plans Report or Zephyr’s Test Metrics to review the testing progress for the sprint.
    • Ensure all critical tests have passed before marking stories as done.

Hands-On Labs

Lab 1: Add a New Story and Test Case

  • Task: In the Book Management Scrum project, add a new story under the Book Search Functionality epic: “As a user, I want to search for a book by title to find it quickly.” Create a test case in Xray to verify this functionality.
  • Steps:
    1. Create the story in the backlog.
    2. Create a Test issue in Xray with steps to send a GET request to /api/books?title=<title> and verify the response.
    3. Add the test to a new Test Set and Test Plan for the next sprint.

Lab 2: Create a Regression Test Cycle in Zephyr

  • Task: In the User Management Scrum project, create a regression test cycle for the next sprint that includes all tests from Sprint 1 - User CRUD.
  • Steps:
    1. Clone the Sprint 1 Regression Cycle - Users in Zephyr.
    2. Add any new test cases created during the sprint.
    3. Assign the cycle to the next sprint.

Lab 3: Automate a Test with Xray

  • Task: In the Book Management Scrum project, mark a test case as automated and simulate its execution using a CI tool (e.g., Jenkins).
  • Steps:
    1. Update the Test adding a new book with valid data test case in Xray to be automated (change Test Type to Automated).
    2. Simulate a CI pipeline by manually updating the test execution status to Passed (in a real scenario, you’d integrate with a CI tool like Jenkins using Xray’s REST API).

Key Concepts and Best Practices

  1. Scrum Workflow in Jira:
    • Use epics to group related stories, stories to define user requirements, and sub-tasks to break down work.
    • Prioritize the backlog regularly and plan sprints collaboratively with the team.
  2. Test Management with Xray/Zephyr:
    • Xray provides a structured approach with Test Plans and Test Executions, ideal for detailed test management.
    • Zephyr is simpler and focuses on test cycles, making it easier for teams new to test management.
  3. Integration with Development:
    • Link test cases to stories to ensure traceability.
    • Log bugs directly from test executions to streamline defect tracking.
  4. Collaboration:
    • Use Jira’s sprint board and Xray/Zephyr reports to keep the team and stakeholders informed about progress.

Additional Notes

  • Choosing Between Xray and Zephyr:
    • Xray is more feature-rich and supports advanced test planning and automation integration, making it suitable for complex projects.
    • Zephyr (especially Zephyr Scale) is lighter and easier to use for teams starting with test management in Jira.
  • Scaling Scrum:
    • As your team grows, consider using Jira’s advanced features like the Timeline view for epic planning or integrating with Confluence for sprint documentation.
  • Automation:
    • Both Xray and Zephyr support automated testing. In a real-world scenario, you’d integrate with a CI/CD pipeline (e.g., Jenkins, GitLab) to run automated tests and report results back to Jira.

This tutorial provides a comprehensive guide to using Jira, Xray, and Zephyr for Scrum and test management. By completing the labs, you’ll gain hands-on experience in managing a software project from backlog to testing, ensuring quality and collaboration in a Scrum team.


By Wahid Hamdi