Skip to content

Commit 93633ac

Browse files
committed
Merge pull request #1145 from Aman1905/stage
kaneai variable json guide
1 parent 18371e7 commit 93633ac

File tree

10 files changed

+117
-1
lines changed

10 files changed

+117
-1
lines changed
5.96 MB
Binary file not shown.
97.1 KB
Loading
99 KB
Loading
98.9 KB
Loading
99.9 KB
Loading
98.7 KB
Loading
98.1 KB
Loading
101 KB
Loading
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
---
2+
id: kane-ai-using-json-variables
3+
title: KaneAI - Utilizing JSON Variables for Assertions
4+
hide_title: false
5+
sidebar_label: JSON Variables Guide
6+
description: Learn how to use JSON variables in the KaneAI test cases for assertions
7+
keywords:
8+
- lambdatest automation
9+
- lambdatest kaneai
10+
- kaneai scroll elements
11+
- kaneai sidebar scroll
12+
url: https://www.lambdatest.com/support/docs/kane-ai-using-json-variables/
13+
site_name: LambdaTest
14+
slug: kane-ai-using-json-variables/
15+
---
16+
17+
<script type="application/ld+json"
18+
dangerouslySetInnerHTML={{ __html: JSON.stringify({
19+
"@context": "https://schema.org",
20+
"@type": "BreadcrumbList",
21+
"itemListElement": [{
22+
"@type": "ListItem",
23+
"position": 1,
24+
"name": "Home",
25+
"item": "https://www.lambdatest.com"
26+
},{
27+
"@type": "ListItem",
28+
"position": 2,
29+
"name": "Support",
30+
"item": "https://www.lambdatest.com/support/docs/"
31+
},{
32+
"@type": "ListItem",
33+
"position": 3,
34+
"name": "KaneAI Jira Integration",
35+
"item": "https://www.lambdatest.com/support/docs/kane-ai-using-json-variables/"
36+
}]
37+
})
38+
}}
39+
></script>
40+
This document outlines the process of using JSON variables in KaneAI to assert specific objects within an API response. The guide provides a step-by-step procedure for executing API calls, examining responses, and performing assertions on both status and body of the response.
41+
42+
## Prerequisites
43+
- Access to KaneAI platform
44+
- Basic understanding of API testing
45+
- Familiarity with JSON structures
46+
47+
## Step 1: Understanding JSON Variable Assertions
48+
In KaneAI, you can use JSON variables to perform detailed assertions on API responses. This allows you to validate specific objects and elements within the response structure.
49+
50+
## Step 2: Initiating an API Call
51+
- Navigate to your desired API endpoint (e.g., a pet store website)
52+
- Configure the necessary API call parameters
53+
- Execute the API request
54+
55+
### Example Workflow:
56+
- Select the appropriate HTTP method (GET, POST, etc.)
57+
- Add required headers
58+
- Input any necessary request body
59+
- Send the request
60+
61+
<img loading="lazy" src={require('../assets/images/kane-ai/knowledge-base/variables/json-variable/image2.jpg').default} alt="Image" className="doc_img img_center"/>
62+
63+
## Step 3: Accessing Response Variables
64+
After executing the API call, KaneAI automatically generates variables containing:
65+
- Response status code
66+
- Response body
67+
- Response headers
68+
- Other relevant metadata
69+
70+
<img loading="lazy" src={require('../assets/images/kane-ai/knowledge-base/variables/json-variable/image3.jpg').default} alt="Image" className="doc_img img_center"/>
71+
72+
## Step 4: Asserting Response Status
73+
To assert the response status:
74+
75+
- Use double curly braces `{{` to access the variable list
76+
- Navigate using arrow keys to select the status variable
77+
- Define your expected status code
78+
79+
<img loading="lazy" src={require('../assets/images/kane-ai/knowledge-base/variables/json-variable/image4.jpg').default} alt="Image" className="doc_img img_center"/>
80+
81+
### Example:
82+
- Expected status: 200
83+
- If actual status is 500, the assertion will fail
84+
85+
<img loading="lazy" src={require('../assets/images/kane-ai/knowledge-base/variables/json-variable/image5.jpg').default} alt="Image" className="doc_img img_center"/>
86+
87+
## Step 5: Asserting Response Body
88+
Navigate through the response body using the same double curly brace method:
89+
- Open the variable selection menu with `{{`
90+
- Browse to the specific JSON element you want to validate
91+
- Create an assertion for that element
92+
93+
<img loading="lazy" src={require('../assets/images/kane-ai/knowledge-base/variables/json-variable/image6.jpg').default} alt="Image" className="doc_img img_center"/>
94+
95+
### Example Validation:
96+
- Check if 'dogs' element exists in the response
97+
- Verify specific property values
98+
- Validate nested JSON structures
99+
100+
<img loading="lazy" src={require('../assets/images/kane-ai/knowledge-base/variables/json-variable/image7.jpg').default} alt="Image" className="doc_img img_center"/>
101+
102+
<br />
103+
104+
## Video Explanation
105+
<video class="right-side" width="100%" controls id="vid">
106+
<source src= {require('../assets/images/kane-ai/knowledge-base/variables/json-variable.mp4').default} type="video/mp4" />
107+
</video>

sidebars.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,16 @@ module.exports = {
10701070
items: [
10711071
"kane-ai-command-guide",
10721072
"kane-ai-web-test-writing-guidelines",
1073-
"kane-ai-using-variables"
1073+
{
1074+
type: "category",
1075+
collapsed: true,
1076+
label: "Variables Guide",
1077+
link: {
1078+
type: "doc",
1079+
id: "kane-ai-using-variables"
1080+
},
1081+
items: ["kane-ai-using-json-variables"]
1082+
},
10741083
],
10751084
},
10761085
{

0 commit comments

Comments
 (0)