# 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 → Integrations → Bug Tracking → 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 Development → 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**

ContextQA reads the ticket summary, description, and acceptance criteria, then creates:

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

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

### 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.

### 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 → Integrations → Jira → Automation Rules**

***

## Filtering Tests by Jira Ticket

In the ContextQA Test Development 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 → Integrations → Bug Tracking → 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](https://learning.contextqa.com/integrations/azure-devops) 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 %}
