In Qodex, test rules define the expected behavior of your APIs — including assertions on response data, status codes, and even validations against your database.
1. AI-Suggested Rules (No Setup Required)
When you create test scenarios using the AI Agent, Qodex automatically suggests a set of relevant rules under the Suggested tab.
These are intelligently generated based on:
- The API’s response schema
- Typical validation patterns (e.g., status code checks, key presence)
- Historical assertions across similar endpoints
Common examples:
- Status code should be 200
- Response body should contain user_id
- Error message should be shown if email is missing
Click to apply the rules directly, or customize as needed.
2. Manual Rules (Assertions + DB Validation)
If your scenario needs custom logic:
- Switch to the Write tab
- Choose from:
- Assertion: validate status codes, keys, values in the response
- DB Validation: write natural language rules to cross-check against your database (e.g., Postgres)
You can simply write the rule in English like:
- “If the user is created, their name and email should match the DB”
- “If token is missing, return 401”
Qodex converts this into JS-style test logic and executes it for you.