-
Notifications
You must be signed in to change notification settings - Fork 33
Updated REST APIs verifications doc #948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -26,21 +26,77 @@ contextual_links: | |||||||||||
|
|
||||||||||||
| --- | ||||||||||||
|
|
||||||||||||
| In Testsigma, you can check whether the Rest API is functioning correctly by adding verification and assertions. This involves testing the API endpoints, the data returned, and the response codes. Verification also includes validating the API against the requirements and ensuring that the API is secure. For verification, you need to add an API request and click **Create** to check the response. At the bottom of the screen, you can see the response and add verification. There are some steps to adding verification. | ||||||||||||
| In Testsigma, you can validate whether a REST API is functioning correctly by adding verifications (assertions). These help ensure that the API response matches the expected status, headers, and body content. | ||||||||||||
|
|
||||||||||||
| **To add verification:** | ||||||||||||
| - Send an API request. | ||||||||||||
| - Review the response at the bottom of the screen. | ||||||||||||
| - Click **Create** and add verification from the **Verification** tab. | ||||||||||||
|
|
||||||||||||
| --- | ||||||||||||
|
|
||||||||||||
| ## **Verification Types** | ||||||||||||
|
|
||||||||||||
| These types of verification are available for JSON and XML: | ||||||||||||
| Verification types define how the response (JSON/XML) is compared with the expected value. | ||||||||||||
|
|
||||||||||||
| **1. Strict** | ||||||||||||
| - Exact match required | ||||||||||||
| - No extra fields allowed | ||||||||||||
| - Array order must match | ||||||||||||
|
|
||||||||||||
| **2. Strict Order** | ||||||||||||
| - Same as Strict | ||||||||||||
| - Field order must also match | ||||||||||||
|
|
||||||||||||
| **3. Lenient (Recommended)** | ||||||||||||
| - Validates only specified fields | ||||||||||||
| - Extra fields allowed | ||||||||||||
| - Order ignored | ||||||||||||
|
|
||||||||||||
| **4. Non Extensible** | ||||||||||||
| - No extra fields allowed | ||||||||||||
| - Order ignored | ||||||||||||
|
|
||||||||||||
| **5. Schema** | ||||||||||||
| - Validates structure and data types, not exact values | ||||||||||||
|
|
||||||||||||
| ### **Quick Summary** | ||||||||||||
|
|
||||||||||||
| | Type | Extra Fields Allowed | Order Check | Value Validation | | ||||||||||||
| |------------------|--------------------|--------------|-------------------------------| | ||||||||||||
| | **Strict** | ❌ No | Arrays only | Exact match required | | ||||||||||||
| | **Strict Order** | ❌ No | ✔ Full order | Exact match required | | ||||||||||||
| | **Lenient** | ✔ Yes | ❌ No | Only specified fields checked | | ||||||||||||
| | **Non Extensible**| ❌ No | ❌ No | Exact match required | | ||||||||||||
| | **Schema** | Depends | ❌ No | Structure & type validation | | ||||||||||||
|
|
||||||||||||
| > <p id="prerequisites">💡 Tip:</p> | ||||||||||||
| > Use Lenient for most APIs with dynamic fields. | ||||||||||||
|
|
||||||||||||
| ### **For Example:** | ||||||||||||
|
|
||||||||||||
| **Expected:** | ||||||||||||
|
|
||||||||||||
| ``` | ||||||||||||
| { | ||||||||||||
| "name": "Ganesh" | ||||||||||||
| } | ||||||||||||
| ``` | ||||||||||||
|
Comment on lines
+80
to
+84
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add language identifier to code block. The code block is missing a language identifier, which reduces syntax highlighting and accessibility. As per static analysis tools, fenced code blocks should specify the language. 🎨 Proposed fix-```
+```json
{
"name": "Ganesh"
}📝 Committable suggestion
Suggested change
🧰 Tools🪛 markdownlint-cli2 (0.21.0)[warning] 80-80: Fenced code blocks should have a language specified (MD040, fenced-code-language) 🤖 Prompt for AI Agents |
||||||||||||
|
|
||||||||||||
| **Response:** | ||||||||||||
|
|
||||||||||||
| ``` | ||||||||||||
| { | ||||||||||||
| "name": "Ganesh", | ||||||||||||
| "age": 30, | ||||||||||||
| "city": "Bangalore" | ||||||||||||
| } | ||||||||||||
| ``` | ||||||||||||
|
Comment on lines
+88
to
+94
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add language identifier to code block. The code block is missing a language identifier, which reduces syntax highlighting and accessibility. As per static analysis tools, fenced code blocks should specify the language. 🎨 Proposed fix-```
+```json
{
"name": "Ganesh",
"age": 30,
"city": "Bangalore"
}🧰 Tools🪛 markdownlint-cli2 (0.21.0)[warning] 88-88: Fenced code blocks should have a language specified (MD040, fenced-code-language) 🤖 Prompt for AI Agents |
||||||||||||
|
|
||||||||||||
| In this case, | ||||||||||||
| - **Lenient:** Passes as it validates only the specified field (**name**) and ignores extra fields. | ||||||||||||
|
|
||||||||||||
| |Verification Types|Function| | ||||||||||||
| | :----: | :----: | | ||||||||||||
| | **Strict** | In strict verification, all conditions and rules must be met exactly as specified. If any requirements are met, the verification will succeed.| | ||||||||||||
| | **Strict Order** | In strict order verification, the conditions and rules must be met in the specified order. The verification will only succeed if any requirement is met or is in order. | | ||||||||||||
| | **Lenient** | In lenient verification, some conditions and rules may be ignored or relaxed, and the verification will still pass as long as the essential requirements are met.| | ||||||||||||
| | **Non-extensible** | In non-extensible verification, the verification rules cannot be modified or extended. Only the pre-defined rules can be applied. | | ||||||||||||
| | **Schema** | A schema is a set of rules defining data or documents' structure, format, and constraints. It can validate, verify, or transform data in different contexts, such as databases, APIs, or file formats. | | ||||||||||||
| - **Strict:** Fails as extra fields (**age**, **city**) are not allowed. | ||||||||||||
|
|
||||||||||||
| --- | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expand the Schema verification type description.
The Schema type description is notably brief compared to other verification types (1 line vs 3-4 bullet points). It doesn't clarify:
Consider adding bullet points similar to other types for consistency and clarity.
📝 Suggested expansion
📝 Committable suggestion
🤖 Prompt for AI Agents