Forum Discussion

shakunagaraju's avatar
6 months ago

variable

how we store variable value and how we called value to script value.

1 Reply

  • Humashankar's avatar
    Humashankar
    Champion Level 0

    Hi shakunagaraju 

    In LoadNinja, you can store variable values using the "Variables" tab in the test scenario editor. Here's how:

     

    Ø  Create a new variable by clicking the "Add Variable" button.

    Ø  Enter a name for your variable and set its value.

    Ø  Save the variable.

     

    To use the variable value in your script, you can use the following syntax:

    ${variable_name}

    Replace "variable_name" with the actual name of the variable you created.

    Instance, if you created a variable called "api_key" with the value "my_secret_key", you can use it in your script like this:

    ${api_key}

    This will replace the syntax with the actual value of the variable, which is "my_secret_key".

    Add on infomation you can also use variables in other parts of your test scenario, such as in the URL or in a request body. Just use the same syntax: ${variable_name}.

     

    PS: This response inputs might also carry some research outcomes from the open source / blogs / user guide

    Hope this helps - Happy to help further!!
    Thank you very much and have a great one!

    Warm regards