Skip to content

Commit dd07591

Browse files
Aman1905Ishavyas9
authored andcommitted
kane ai variables guide
1 parent c290f52 commit dd07591

File tree

3 files changed

+91
-1
lines changed

3 files changed

+91
-1
lines changed
100 KB
Loading

docs/kane-ai-using-variables.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
---
2+
id: kane-ai-using-variables
3+
title: KaneAI - Using Variables in Test Cases
4+
hide_title: false
5+
sidebar_label: Variables Guide
6+
description: Learn how to use variables in the KaneAI test cases
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-variables/
13+
site_name: LambdaTest
14+
slug: kane-ai-using-variables/
15+
---
16+
17+
import Tabs from '@theme/Tabs';
18+
import TabItem from '@theme/TabItem';
19+
import CodeBlock from '@theme/CodeBlock';
20+
import {YOUR_LAMBDATEST_USERNAME, YOUR_LAMBDATEST_ACCESS_KEY} from "@site/src/component/keys";
21+
22+
<script type="application/ld+json"
23+
dangerouslySetInnerHTML={{ __html: JSON.stringify({
24+
"@context": "https://schema.org",
25+
"@type": "BreadcrumbList",
26+
"itemListElement": [{
27+
"@type": "ListItem",
28+
"position": 1,
29+
"name": "Home",
30+
"item": "https://www.lambdatest.com"
31+
},{
32+
"@type": "ListItem",
33+
"position": 2,
34+
"name": "Support",
35+
"item": "https://www.lambdatest.com/support/docs/"
36+
},{
37+
"@type": "ListItem",
38+
"position": 3,
39+
"name": "KaneAI Jira Integration",
40+
"item": "https://www.lambdatest.com/support/docs/kane-ai-using-variables/"
41+
}]
42+
})
43+
}}
44+
></script>
45+
The new variable definition feature in KaneAI allows users to define reusable variables, assign them values, and use those values within test cases. This feature enhances flexibility, readability, and consistency across test cases, making it easier to maintain and modify them.
46+
47+
## Why Use Variables?
48+
Using variables enables you to:
49+
- Avoid repetitive entries in test cases.
50+
- Update values in one place without needing to modify multiple test cases.
51+
- Increase the reusability and adaptability of test scripts, especially useful for parameters that might change frequently, such as URLs, credentials, or environmental settings.
52+
53+
## Variable Syntax
54+
To work with variables in KaneAI, you need to follow these syntax rules:
55+
56+
- Variables are defined using the `$` prefix
57+
- Variable names should follow the `$` symbol without any spaces
58+
- Example: `$username`, `$phoneNumber`, `$address`
59+
60+
## Creating Variables
61+
To create a variable:
62+
63+
- Navigate to the "Write a Step" text field
64+
- Type your instruction using the following format: *create a variable `$variableName`*
65+
66+
Example:
67+
```bash
68+
create a variable $phoneNumber
69+
```
70+
71+
## Using Variables
72+
To use a previously created variable in any subsequent step or test case, reference the variable using the same `$` syntax. Format: *use the value of `$variableName`*
73+
74+
Example:
75+
```bash
76+
use the value of $phoneNumber in the given text field
77+
```
78+
<img loading="lazy" src={require('../assets/images/kane-ai/knowledge-base/variables/1.png').default} alt="kenai-jira integration" className="doc_img"/>
79+
80+
## Best Practices
81+
### Naming Conventions
82+
- Use descriptive names for your variables
83+
- Avoid special characters except for the required $ prefix
84+
- Use camelCase for multi-word variable names
85+
86+
### Variable Management
87+
- Create variables at the beginning of your test case when possible
88+
- Document the purpose of each variable in comments
89+
- Verify that variables are defined before using them

sidebars.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,8 @@ module.exports = {
10471047
label: "Knowledge Base",
10481048
items: [
10491049
"kane-ai-command-guide",
1050-
"kane-ai-web-test-writing-guidelines"
1050+
"kane-ai-web-test-writing-guidelines",
1051+
"kane-ai-using-variables"
10511052
],
10521053
},
10531054
{

0 commit comments

Comments
 (0)