# For Developers

{% hint style="info" %}
**Who is this for?** Frontend developers, full-stack engineers, and backend developers who want fast feedback on their changes without becoming QA experts.
{% endhint %}

You're not a tester — but you're responsible for not breaking things. ContextQA integrates directly into your development workflow: generate tests from your tickets before you write the first line of code, run them from your IDE via MCP, and get AI-generated root cause reports in your terminal when something fails.

***

## Developer Workflow Integration

### Generate Tests from Your Jira Ticket

Before writing code, generate test cases from the acceptance criteria in your Jira ticket:

```python
# In Claude / Cursor with ContextQA MCP connected
generate_tests_from_jira_ticket(
    ticket_id="PROJ-456"
)
# → Creates 3 test cases covering the acceptance criteria
# → Test Case IDs: 18850, 18851, 18852
```

This gives you a test suite to run against your branch before opening a PR — no QA involvement required for the initial coverage.

→ [AI Test Generation](/ai-features/ai-test-generation.md)

### Run Tests from Your Terminal

With the ContextQA MCP server connected to your AI coding assistant:

```bash
# Ask Claude/Cursor directly:
"Run test case 18850 and tell me if it passes"

# Or use the MCP tool directly:
execute_test_case(test_case_id=18850)
```

You get back a pass/fail result with screenshot and video evidence — no context switching to a browser.

### Get Root Cause in Seconds

When a test fails, don't stare at a cryptic error. Ask for root cause:

```python
get_root_cause(execution_id=26300)
# Returns:
# {
#   "failure_summary": "The 'Add to Cart' button was not found on the product page.",
#   "affected_step": 4,
#   "classification": "APPLICATION_BUG",
#   "suggested_fix": "Check that the ProductCard component renders the button when stock > 0.",
#   "evidence_used": ["screenshot_step_4", "console_log", "har"]
# }
```

The `classification` field tells you immediately: is this your bug or a test problem?

→ [Failure Analysis](/reporting/failure-analysis.md)

***

## CI/CD Quality Gate

Add a ContextQA quality gate to your pull request checks. Tests run automatically when you push — the PR is blocked until all tests pass.

**GitHub Actions example:**

```yaml
name: ContextQA Tests
on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    env:
      CONTEXTQA_BASE_URL: https://server.contextqa.com
    steps:
      - name: Authenticate with ContextQA
        id: auth
        run: |
          AUTH_RESPONSE=$(curl -s -X POST "${CONTEXTQA_BASE_URL}/api/v1/auth/login" \
            -H "Content-Type: application/json" \
            -d "{\"username\":\"${{ secrets.CONTEXTQA_USERNAME }}\",\"password\":\"${{ secrets.CONTEXTQA_PASSWORD }}\"}")
          echo "token=$(echo $AUTH_RESPONSE | jq -r '.token')" >> $GITHUB_OUTPUT

      - name: Trigger Test Plan
        id: trigger
        run: |
          RESULT=$(curl -s -X GET \
            "${CONTEXTQA_BASE_URL}/api/v1/testplans/${{ vars.TEST_PLAN_ID }}/execute" \
            -H "Authorization: Bearer ${{ steps.auth.outputs.token }}")
          echo "execution_id=$(echo $RESULT | jq -r '.executionId')" >> $GITHUB_OUTPUT

      - name: Wait for Results
        run: |
          ATTEMPT=0
          MAX_ATTEMPTS=60
          while [ "$ATTEMPT" -lt "$MAX_ATTEMPTS" ]; do
            STATUS=$(curl -s -X GET \
              "${CONTEXTQA_BASE_URL}/api/v1/executions/${{ steps.trigger.outputs.execution_id }}/status" \
              -H "Authorization: Bearer ${{ steps.auth.outputs.token }}" | jq -r '.status')
            echo "Attempt $((ATTEMPT+1)): $STATUS"
            [ "$STATUS" != "RUNNING" ] && [ "$STATUS" != "PENDING" ] && break
            sleep 30
            ATTEMPT=$((ATTEMPT + 1))
          done
          [ "$STATUS" = "FAILED" ] && exit 1 || exit 0
```

→ [GitHub Actions Integration](/integrations/github-actions.md)

***

## Generating Tests from Your Codebase

If you have code changes that need test coverage, generate tests based on the diff:

```python
generate_tests_from_code_change(
    diff_text="Added a discount code field to the checkout form. Valid codes apply 10-20% off.",
    app_url="https://staging.yourapp.com"
)
```

For API changes, generate tests directly from your OpenAPI/Swagger spec:

```python
generate_tests_from_swagger(
    file_path_or_url="https://staging.yourapp.com/api/docs/swagger.json"
)
```

→ [Creating API Tests](/api-testing/creating-api-tests.md)

***

## API Testing for Backend Developers

ContextQA supports REST API testing natively — no browser required:

{% tabs %}
{% tab title="Create API Test" %}

```
Step 1: POST https://api.yourapp.com/users
Body: {"email": "test@example.com", "password": "SecurePass123"}
Assert: Status 201
Assert: Response body contains "userId"
```

{% endtab %}

{% tab title="Chain API Calls" %}
API Chaining lets you use response values in subsequent requests:

```
Step 1: POST /auth/login → extract token from response
Step 2: GET /users/profile → use token in Authorization header
Step 3: Assert profile.email equals "test@example.com"
```

{% endtab %}

{% tab title="Validate Responses" %}
Assert on:

* HTTP status codes
* Response body fields (exact match, contains, regex)
* Response headers
* Response time (SLA validation)
* Schema compliance (JSON Schema validation)
  {% endtab %}
  {% endtabs %}

→ [API Testing Overview](/api-testing/api-testing.md)

***

## Connecting Your AI Coding Assistant

Add the ContextQA MCP server to Claude Desktop, Cursor, or any MCP-compatible client:

**Claude Desktop (`~/.claude/claude_desktop_config.json`):**

```json
{
  "mcpServers": {
    "contextqa": {
      "command": "docker",
      "args": ["run", "-i", "--rm",
        "-e", "API_TOKEN=your-token-here",
        "contextqa/mcp-server:latest"
      ]
    }
  }
}
```

Once connected, you can ask your AI assistant to:

* *"Run the smoke test suite on the staging environment"*
* *"Generate tests for the new payment flow I just built"*
* *"Why did test case 18850 fail in the last run?"*
* *"Create a test plan that covers all checkout tests"*

→ [MCP Installation & Setup](/mcp-server/installation-and-setup.md) | [Agent Integration Guide](/mcp-server/agent-integration-guide.md)

***

## Reproducing Bugs from Tickets

When a bug is reported in Jira, reproduce it automatically:

```python
reproduce_from_ticket(
    ticket_text="BUG-789: Add to Cart button not visible on product page when stock > 0",
    url="https://yourcompany.app.com/products"
)
# Analyzes the bug description and steps to reproduce
# Generates and executes a reproduction test case
# Returns: pass/fail + evidence if reproduced
```

→ [Bug, Defect & Advanced Testing tools](/mcp-server/tool-reference/bug-defect-and-advanced.md)

***

{% hint style="success" %}
**Recommended path for developers:**

1. [MCP Installation](/mcp-server/installation-and-setup.md) — connect to your IDE in 10 minutes
2. [AI Test Generation](/ai-features/ai-test-generation.md) — generate tests from Jira tickets
3. [Jira Integration](/integrations/jira.md) — connect Jira for automatic defect filing
4. [GitHub Actions](/integrations/github-actions.md) — add a CI quality gate
5. [API Testing](/api-testing/api-testing.md) — test your endpoints directly
   {% endhint %}

***

{% hint style="info" %}
**Ship faster without breaking things.** [**Book a Developer Demo →**](https://contextqa.com/book-a-demo/) — See how to integrate ContextQA into your PR workflow in under 15 minutes.

*Development teams using ContextQA catch 80% more regressions before they reach production.*
{% endhint %}


---

# Agent Instructions: 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:

```
GET https://learning.contextqa.com/documentation-by-role/by-role/for-developers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
