Reporting Failed Tests to Jira
Step-by-step instructions to integrate TestDriver with Jira for automated test failure tracking in CI/CD workflows.
Automating Jira ticket creation for test failures using TestDriver and Jira GitHub Actions
This guide explains how to integrate the TestDriver GitHub Action with the Jira GitHub Action to automatically create a Jira ticket whenever a TestDriver test fails. This workflow ensures that test failures are tracked in Jira, enabling teams to address issues promptly.
Workflow overview
Run Tests with TestDriver
Check for Test Failures
Create a Jira Ticket
Prerequisites
- TestDriver API Key: Store your API key as a GitHub secret (for example,
TD_API_KEY
). - Jira API Token: Generate an API token from your Jira account and store it as a GitHub secret (for example,
JIRA_API_TOKEN
). - Jira Base URL: Your Jira instance URL (for example,
https://yourcompany.atlassian.net
). - Jira Project Key: The key of the Jira project where tickets will be created (for example,
TEST
).
GitHub Actions workflow
Here’s a complete workflow that integrates TestDriver and Jira:
Workflow File: .github/workflows/testdriver-jira.yaml
Workflow steps explained
1. Run Tests with TestDriver
The testdriverai/action@main
step runs your TestDriver tests and captures the results. The outputs.success
variable indicates whether the tests passed or failed.
2. Check for test failures
This step checks the outputs.success
variable from the TestDriver action. If the tests failed, it sets an environment variable (failure=true
) to trigger the Jira ticket creation step.
3. Create a Jira ticket
If any tests failed, the create-jira-ticket
job uses the atlassian/gajira-create
action to create a new Jira ticket. The ticket includes:
- Summary: A brief description of the failure.
- Description: Detailed information about the failure, including the test summary and markdown output from TestDriver.
Secrets configuration
Add the following secrets to your GitHub repository:
TD_API_KEY
: Your TestDriver API key.JIRA_API_TOKEN
: Your Jira API token.JIRA_BASE_URL
: Your Jira instance URL (for example,https://yourcompany.atlassian.net
).JIRA_USERNAME
: Your Jira account email.
Example Jira ticket
Summary:
Test Failure: Login Test Failed
Description:
Benefits of this workflow
- Automated Issue Tracking: Automatically creates Jira tickets for test failures, ensuring no issues are overlooked.
- Detailed Context: Includes test summaries and failure details in the Jira ticket for easier debugging.
- Streamlined Workflow: Integrates testing and issue tracking into a single automated pipeline.
By combining TestDriver and Jira GitHub Actions, you can automate the process of tracking test failures, improving collaboration and ensuring faster resolution of issues.