> For the complete documentation index, see [llms.txt](https://learning.contextqa.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learning.contextqa.com/integrations/jira.md).

# Jira

{% hint style="info" %}
**Who is this for?** SDETs, developers, and engineering managers who want to generate tests from Jira tickets and report defects directly from ContextQA test failures.
{% endhint %}

The ContextQA Jira integration creates a two-way connection between your requirements and your test suite. You can generate test cases directly from a Jira user story, view live execution status inside Jira, and report defects as Jira issues without leaving the test result page.

***

## Setting Up the Jira Integration

### Step 1: Connect from the ContextQA Side

1. Navigate to **Settings → Plugins → Bug Reporting → Jira**
2. Enter your Jira base URL — for Jira Cloud this is `https://yourorg.atlassian.net`; for Jira Server it is your internal server URL
3. Enter the email address associated with your Jira account
4. Enter your Jira API token:
   * Go to [id.atlassian.com/manage-profile/security/api-tokens](https://id.atlassian.com/manage-profile/security/api-tokens)
   * Click **Create API token**, give it a label (e.g., "ContextQA"), and copy the token
5. Select the **default project** for defect creation — this is the project that new bug tickets will be created in unless you override it at the time of reporting
6. Click **Connect and Verify** — ContextQA tests the connection and confirms it is working

### Step 2: Install the ContextQA Panel in Jira (Optional)

For teams who want to access ContextQA features directly from within Jira:

1. In your Jira account, open any ticket
2. Click the **App Actions** icon in the ticket detail page toolbar
3. Choose **ContextQA Panel**
4. The ContextQA panel is now available on all tickets in the project

The panel shows linked test cases, their execution status, and a button to trigger test generation from the ticket.

***

## Generating Tests from Jira Tickets

### In the ContextQA UI

1. Navigate to **Test Cases → New Test Case**
2. Select **Generate from Jira Ticket**
3. Enter the ticket ID (e.g., `MYAPP-123`)
4. Choose whether to generate tests for acceptance criteria individually
5. Click **Generate**

**Using the Jira ticket picker:**

1. Search for tickets by entering a key (e.g., `PROJ-123`), text, JQL, or an epic key in the search bar
2. Narrow results by issue type using the filter above the result list. Select **All**, **Story**, **Bug**, **Task**, **Epic**, **Sub-task**, or **Improvement** — changing the filter fetches matching tickets from the first page.
3. Browse results with infinite scroll and select one or more tickets by clicking the checkbox on each row. Each row displays the ticket key, issue type, parent key (if applicable), and summary.
4. Enable the **Include linked tickets** toggle to automatically pull in sub-tasks and epic children for the selected tickets (the picker displays up to 50 linked tickets).
5. Review the selection count in the footer and click **Continue to Review**

ContextQA reads the selected ticket summaries, descriptions, and acceptance criteria, then creates:

* One test case for the primary user story flow in each ticket
* One test case per acceptance criterion (if that option is enabled)
* Edge case scenarios for any validation rules described in the tickets

Generated test cases are automatically labeled with the Jira ticket ID for traceability filtering.

{% hint style="info" %}
You can also generate tests from a single Jira ticket by entering the ticket ID directly in the AI Assistance tab when creating a test case.
{% endhint %}

### Via MCP

```python
generate_tests_from_jira_ticket(
    ticket_id="MYAPP-567",
    include_acceptance_criteria=True
)
```

**What the AI reads from the ticket:**

* Summary (title)
* Description
* Acceptance criteria (the "AC:" or numbered list sections)
* Labels and priority (used to infer edge case importance)
* Linked tickets (for understanding dependencies)

### From the Jira Panel

If the ContextQA panel is installed in Jira:

1. Open the Jira ticket
2. In the ContextQA panel, click **Create Test Cases**
3. ContextQA generates and links the test cases automatically
4. Test cases appear in the panel with their current execution status

***

## Running Tests from Jira

With test cases linked to a Jira ticket, you can trigger execution from the ContextQA panel inside Jira:

1. Open the Jira ticket
2. In the ContextQA panel, find the linked test cases
3. Click **Execute** next to the test case you want to run, or **Execute All** to run all linked tests
4. The panel updates with a status indicator (Running → Passed / Failed) as the execution progresses

You can also run tests from ContextQA directly and the results will be visible in the Jira panel the next time you open the ticket.

***

## Auto-Creating Defects from Test Failures

When a test case fails and the failure indicates a genuine application bug, ContextQA can create a Jira issue automatically with all relevant evidence attached.

### Via the UI

1. Open the failed test execution report in ContextQA
2. Click the **Create Bug** button (or **JIRA** button in the failure reporting toolbar)
3. Select the Jira project and issue type (Bug is the default)
4. Optionally customize the summary and description
5. Click **Create Issue**

ContextQA creates the Jira issue and populates it with:

* **Summary:** Derived from the test case name and the failing step
* **Description:** AI-generated root cause explanation, reproduction steps, and the exact step that failed
* **Attachment:** The failure screenshot
* **Links:** A direct URL to the ContextQA execution (for video, trace, and full step log access)
* **Labels:** The test case label (Jira ticket ID) for traceability

A link to the newly created issue appears immediately in the ContextQA execution report.

### Automatic bug creation and sync status

When automatic Jira bug creation is enabled, ContextQA creates a Jira issue automatically when a test run fails. The status of this auto-creation is visible directly on the execution screens:

**Auto-created bug badge:** When ContextQA successfully creates a Jira issue for a failed run, a clickable badge appears in the execution header displaying the Jira issue key (e.g., `MYAPP-1234`). Click the badge to open the issue directly in Jira.

**Sync status banner:** If the automatic bug creation fails (for example, due to invalid field values or permission issues), a warning banner appears at the bottom of the live execution screen and the run results screen. The banner displays the specific error reason (e.g., "labels: The label 'AI Upload' can't contain spaces.") and a **Retry** button. Click **Retry** to attempt the Jira issue creation again. The banner disappears when the sync succeeds or when the issue is created manually.

{% hint style="info" %}
The sync status banner only appears when the auto-creation pipeline fails. It does not appear for successful syncs, pending syncs, or legacy runs that predate this feature.
{% endhint %}

### Via MCP

```python
create_defect_ticket(
    execution_id="27045",
    project_id="MYAPP"
)
# Returns: {"ticket_id": "MYAPP-1234", "url": "https://yourorg.atlassian.net/browse/MYAPP-1234"}
```

This is the recommended approach for automated triage pipelines. Combine it with `get_execution_status` and `get_root_cause` to build a workflow that creates a Jira bug only when a failure persists across multiple runs:

```python
# Run the test
execution = execute_test_case(test_case_id="1234")
status = poll_until_complete(execution)

if status["result"] == "FAILED":
    # Get AI root cause before creating the ticket
    root_cause = get_root_cause(execution_id=status["execution_id"])

    # Create the defect ticket
    ticket = create_defect_ticket(
        execution_id=status["execution_id"],
        project_id="MYAPP"
    )
    print(f"Defect created: {ticket['url']}")
```

***

## Viewing Test Coverage in Jira

The ContextQA panel in Jira shows a summary of test coverage for each ticket:

* **Test Cases Linked:** How many test cases have been generated for or linked to this ticket
* **Last Execution Status:** The most recent execution result for each linked test case
* **Coverage Percentage:** What fraction of the acceptance criteria have corresponding test cases

This view gives product managers and developers visibility into test health without leaving their workflow in Jira.

***

## Bidirectional Status Sync

When you configure the integration with write access to Jira:

* When all test cases for a Jira ticket pass, ContextQA can automatically transition the ticket to a configured status (e.g., **Ready for Release** or **Done**)
* When a test case fails, ContextQA can reopen the linked ticket or add a comment with the failure details
* These automations are configured in **Settings → Plugins → Bug Reporting → Jira**

***

## Filtering Tests by Jira Ticket

In the ContextQA **Test Cases** view, use the **Labels** filter to display only test cases linked to a specific Jira ticket. Labels are applied automatically during generation and follow the Jira ticket number format (e.g., `MYAPP-123`).

***

## Using the Azure DevOps Integration

If your team uses Azure DevOps (ADO) instead of Jira, the integration follows the same patterns. Navigate to **Settings → Plugins → Bug Reporting → Azure DevOps** and configure your ADO organization URL and personal access token. The `create_defect_ticket` MCP tool supports ADO by setting the `tracker` parameter accordingly.

See the [Azure DevOps Integration](/integrations/azure-devops.md) page for full ADO-specific configuration details.

***

## Troubleshooting

**"Cannot connect to Jira" error during setup:**

* Verify the base URL does not have a trailing slash
* For Jira Cloud, the URL format is `https://yourorg.atlassian.net` (not `.com`)
* Confirm the API token is for the same account as the email address entered
* If you are on Jira Server, ensure the ContextQA server can reach the Jira URL (firewall/VPN)

**Test cases not appearing in the Jira panel:**

* Ensure the ticket ID format matches exactly (case-sensitive: `MYAPP-123` not `myapp-123`)
* Confirm the integration is configured from both sides (ContextQA settings and Jira panel installation)

**Defect tickets missing screenshots:**

* Screenshots are attached as links, not as uploaded files, due to Jira attachment size limits
* Click the ContextQA execution link in the Jira issue description to view full screenshots and video

{% hint style="info" %}
**Connect ContextQA to your CI/CD pipeline in 15 minutes.** [**Book a Demo →**](https://contextqa.com/book-a-demo/) — See the full integration walkthrough for your existing toolchain.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://learning.contextqa.com/integrations/jira.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
