The Test Rules Writing Agent helps you define what success looks like for your API tests. Whether you’re checking status codes, validating response fields, or querying your database - Qodex lets you do it all with code or AI-assisted suggestions. Test Rules Pn

How It Works

  1. Go to any Test Scenario Navigate to any existing scenario, expand a test case in it and scroll down to the Test Rules section.
  2. Choose how to write your rule
    • Suggested Rules (AI-generated): Qodex recommends rules like “Status code should be 200” or “Response should include user_id.”
    • Write Your Own:
      • Use plain JavaScript to define validations
      • Use our built-in helper functions like current_response_body, current_status_code, etc.
  3. Two Rule Types Supported
    • Assertion: Validates the response body, headers, status, etc.
    • DB Validation: Run queries (e.g., PostgreSQL) to confirm backend state after an API call.