← Back to Docs

Generate Test

Generate test plan and executable code

Transform your test cases into executable Python code with detailed test plans.

After Onboarding

Onboarding ends after designing test cases. To continue, navigate to the homepage and select a test case to generate its test plan and code.

Generate Test Plan

Click “Generate Test Plan” on a test case page.

AI creates a detailed test plan with multiple steps:

Example Test Plan:

Step 1: Create new user
  API: POST /users
  Expected: 201 Created

Step 2: Verify user exists
  API: GET /users/{id}
  Expected: 200 OK

Step 3: Login with credentials
  API: POST /auth/login
  Expected: 200 OK

Step 4: Access protected resource
  API: GET /users/me
  Expected: 200 OK

Each step includes:

  • Description of what to do
  • API path being called
  • Expected result

Generate Test Code

After generating the test plan, you can generate executable Python code.

Two Generation Modes

Single Step Generation:

  • Click “Generate Code” on a specific step
  • AI generates code for that step only
  • Useful for iterative development

Batch Generation:

  • Click “Generate All Code” for the test case
  • AI generates code for all steps at once
  • Faster for complete test cases

Example Step Code

Example Step Code:

# Step 1: Create new user
# API: POST /users
step1_headers = {'Content-Type': 'application/json'}
step1_body = {
    'name': 'Test User',
    'email': 'test@example.com',
    'password': 'SecurePass123'
}

# Prepare request with authentication
step1_prepared = auth_handler.prepare_request({
    'method': 'POST',
    'url': f'{base_url}/users',
    'headers': step1_headers,
    'body': step1_body
})

# Execute request
step1_response = requests.request(
    method=step1_prepared['method'],
    url=step1_prepared['url'],
    headers=step1_prepared['headers'],
    json=step1_prepared['body']
)

# Validate response
assert step1_response.status_code == 201, \
    f"Expected 201, got {step1_response.status_code}"

# Extract data for next steps
user_id = step1_response.json()['id']

Key Features:

  • Authentication: Automatically applies configured authentication
  • Variable Extraction: Extracts data for use in subsequent steps
  • Assertions: Validates expected behavior
  • Error Messages: Clear error messages when tests fail

Run Test

Click “Run Test” to execute the test.

Execution Process:

  1. Steps execute sequentially
  2. Real-time progress updates
  3. HTTP traffic capture

View Results

Success

All steps completed successfully with execution details:

  • ✅ Status: Passed
  • Duration: Execution time
  • Output: Console output
  • HTTP Traffic: Request/response details

Failure

When tests fail, you’ll see:

  • ❌ Which step failed
  • Error message
  • Request/response data

AI Auto-Fix: Click “Analyze Error” to let AI automatically diagnose and fix the issue.

Learn more: AI Auto-Fix

Edit Test

In the homepage, you can:

  • Edit test plan steps
  • Modify step code
  • Add new steps
  • Delete steps
  • Reorder steps

Troubleshooting

Test Execution Fails

Solutions:

  • Verify API endpoint is accessible
  • Configure authentication if required
  • Check error message for details
  • Use AI Auto-Fix

Next Steps

After generating and running tests:


← Back: Design Test Case | ← Documentation