Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions docs/kane-ai-using-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
## Scope of variables

### Local Variables
Local variables can only be defined using natural language or used as a part of an operation when an instrcution is provided by the user. They are only accessible within the specific test case where they are defined. They help ensure that values are isolated and can be used temporarily within a specific context. A local variable can be converted to a global or an environment variable within the authoring session of KaneAI.

Check failure on line 61 in docs/kane-ai-using-variables.md

View workflow job for this annotation

GitHub Actions / spellcheck

instrcution ==> instruction

### Global Variables
Global variables are accessible across multiple test cases within the entire organisation. They allow values to be reused in multiple places, enhancing consistency and reducing redundancy. Any variable which is converted from local to global has an option to persist value across sessions if the value changes within a session. More details about persist check are added below.
Expand All @@ -73,15 +73,15 @@
You can define variables directly by using the `/` command in the step input and select "Add a variable" option. You are allowed to create _global_ and _environment_ variables using this approach and define their values.
The value of variables can be edited by clicking on the variables listing icon on the top right.

<img loading="lazy" src={require('../assets/images/kane-ai/knowledge-base/variables/variable-listing-in-session.jpg').default} alt="Image" className="doc_img img_center"/>
<img loading="lazy" src={require('../assets/images/kane-ai/knowledge-base/variables/environment.jpg').default} alt="Image" className="doc_img img_center"/>

### Using Natural Language in authoring session
KaneAI allows you to create variables using natural language. For instance, you can write:

```bash
Set username as John
```
This will automatically create a _local_ variable {{username}} with the value "John".
This will automatically create a _local_ variable `{{username}}` with the value "John".
For such _local_ variables, only the scope of the variable can be changed to a global with an option to enable the persist check which ensures that the value when updated in one session or test execution gets persistes across sessions and test executions.


Expand Down Expand Up @@ -128,23 +128,25 @@
The persist check option becomes available only when you change a variable's scope from local to global.
:::

<img loading="lazy" src={require('../assets/images/kane-ai/knowledge-base/variables/persist-value.jpg').default} alt="Image" className="doc_img img_center"/>
<img loading="lazy" src={require('../assets/images/kane-ai/knowledge-base/variables/variable-listing-in-session.jpg').default} alt="Image" className="doc_img img_center"/>

## Environments

### What are Environments?
Environments in KaneAI refer to the different configurations under which the tests are executed. Environments typically represent different stages of deployment (e.g., development, staging, production). Each environment can have its own set of variables tailored to the respective deployment scenario.

<img loading="lazy" src={require('../assets/images/kane-ai/knowledge-base/variables/environment.jpg').default} alt="Image" className="doc_img img_center"/>
<img loading="lazy" src={require('../assets/images/kane-ai/knowledge-base/variables/persist-value.jpg').default} alt="Image" className="doc_img img_center"/>

### How to Use Environments During Test Runs
Once a test case is authored using environment variables, it can then be executed in any environment as long as the variables used in the test case, exist in the requested environment.

**UI**: While executing a test run or scheduling one, you can choose which environment they want to execute a test run on. All the test cases inside a test run can be executed on a single environment only at a point of time.
#### Leveraging UI
While executing a test run or scheduling one, you can choose which environment they want to execute a test run on. All the test cases inside a test run can be executed on a single environment only at a point of time.

<img loading="lazy" src={require('../assets/images/kane-ai/knowledge-base/variables/test-run-environment.jpg').default} alt="Image" className="doc_img img_center"/>

**API**: You can pass environment name programmatically when initiating test runs via the API. This allows you to automate the execution of tests in different environments without manual intervention. For instance,
#### Leveraging API
You can pass environment name programmatically when initiating test runs via the API. This allows you to automate the execution of tests in different environments without manual intervention. For instance,

```bash
curl --location 'https://test-manager-api.lambdatest.com/api/atm/v1/hyperexecute' \
Expand All @@ -158,4 +160,6 @@

This will run the test case in the "staging" environment.

If you have any feedback or suggestions, feel free to reach out at support@lambdatest.com with your comments.


Loading