Modern QA2026What to Feed and How — tiles
Log inJoin
12 / 87 · 02 AI-Augmented Test Design · Context Feeding Strategies← prev⊞ allnext →☰ Read as one page

3.3What to Feed and How

Source How to Feed Why It Matters
OpenAPI/Swagger spec Paste the relevant endpoint JSON/YAML directly Exact field names, types, constraints -- eliminates guesswork
User story + AC Copy from Jira/Linear verbatim Preserves original intent, edge cases mentioned in comments
Existing test file Paste 2-3 representative tests as "style guide" AI matches naming, structure, assertion style, fixtures
Database schema Paste CREATE TABLE statements Reveals constraints AI can test (NOT NULL, UNIQUE, FK, CHECK)
Error code documentation Paste the error catalogue AI generates tests triggering each documented error
UI mockup/Figma Describe the layout or use screenshot + vision model Generates accessibility and layout tests
CI configuration Paste relevant test commands AI understands how tests will be run (parallel, coverage flags)

Feeding an OpenAPI Schema

Here is the OpenAPI schema for the endpoint under test:

```yaml
paths:
  /api/v2/orders:
    post:
      summary: Create a new order
      security:
        - BearerAuth: [customer]
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateOrder'
      responses:
        '201':
          description: Order created
        '400':
          description: Validation error
        '401':
          description: Unauthorized
        '409':
          description: Duplicate order (idempotency key conflict)

components:
  schemas:
    CreateOrder:
      type: object
      required: [items, shipping_address, idempotency_key]
      properties:
        items:
          type: array
          minItems: 1
          maxItems: 50
          items:
            type: object
            required: [product_id, quantity]
            properties:
              product_id:
                type: string
                format: uuid
              quantity:
                type: integer
                minimum: 1
                maximum: 100
        shipping_address:
          $ref: '#/components/schemas/Address'
        idempotency_key:
          type: string
          format: uuid
        coupon_code:
          type: string
          pattern: "^[A-Z0-9]{8}$"

Notice that every constraint in the schema (minItems, maxItems, minimum, maximum, pattern, format) is a test case waiting to be generated. The LLM sees these constraints and produces boundary value tests automatically.

Feeding Existing Tests as a Style Guide

Here are two existing tests from our codebase. Match their style exactly:

```python
class TestOrderCreation:
    """Tests for POST /api/v2/orders endpoint."""

    def test_should_create_order_when_valid_payload(
        self, api_client, auth_headers, product_factory
    ):
        # Arrange
        product = product_factory.create()
        payload = {
            "items": [{"product_id": str(product.id), "quantity": 2}],
            "shipping_address": VALID_ADDRESS,
            "idempotency_key": str(uuid4()),
        }

        # Act
        response = api_client.post(
            "/api/v2/orders", json=payload, headers=auth_headers
        )

        # Assert
        assert response.status_code == 201
        order = response.json()
        assert order["status"] == "pending"
        assert len(order["items"]) == 1
        assert order["items"][0]["quantity"] == 2

    def test_should_reject_order_when_empty_items_list(
        self, api_client, auth_headers
    ):
        # Arrange
        payload = {
            "items": [],
            "shipping_address": VALID_ADDRESS,
            "idempotency_key": str(uuid4()),
        }

        # Act
        response = api_client.post(
            "/api/v2/orders", json=payload, headers=auth_headers
        )

        # Assert
        assert response.status_code == 400
        assert "items" in response.json()["detail"].lower()

By showing two tests -- one happy path, one validation error -- the AI learns:

  • Class structure with docstrings
  • Fixture-based dependency injection (api_client, auth_headers, product_factory)
  • Naming convention: test_should_X_when_Y
  • Comment markers for Arrange/Act/Assert
  • Assertion style (status code + specific field checks)
  • Use of VALID_ADDRESS constant and uuid4()