<
From version < 3.2 >
edited by Outhman Moustaghfir
on 2024/01/30 15:03
To version < 7.1 >
edited by Outhman Moustaghfir
on 2024/01/30 15:10
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -4,6 +4,7 @@
4 4  
5 5  [[image:setvar.png]]
6 6  
7 +
7 7  The SetVar connector is designed to set variables within a scenario by utilizing a JSON file. This connector allows users to define variables and even use dynamic values using expressions.
8 8  
9 9  == Usage ==
... ... @@ -19,12 +19,11 @@
19 19  {{{
20 20   }}}
21 21  
22 -{{code language="XML"}}
23 -SetVar(variable_name, value, global=False)
23 +{{code language="json"}}
24 +{ "var1": "value1", "var2": "true" }
24 24  
25 25  {{/code}}
26 26  
27 -{ "var1": "value1", "var2": "true" }
28 28  
29 29  ==== Example 2: ====
30 30  
... ... @@ -31,16 +31,14 @@
31 31  {{{
32 32   }}}
33 33  
34 -{{code language="XML"}}
35 -SetVar(variable_name, value, global=False)
36 -
34 +{{code language="json"}}
35 +{ "var1": "value1", "var2": "${GetVar;inputFile}", "nestedVar": { "nestedVar1": "val1", "nestedVar2": "val2" } }
37 37  {{/code}}
38 38  
39 -{ "var1": "value1", "var2": "true", "inputFile1": "${GetVar;inputFile}", "nestedVar": { "nestedVar1": "val1", "nestedVar2": "val2" } }
40 40  
41 41  === Dynamic Values ===
42 42  
43 -SetVar supports dynamic values using expressions in the ${GetVar;variableName} format. This allows you to reference the values of other variables within the JSON file.
41 +SetVar supports dynamic values using expressions in the** ${GetVar;variableName}** format. This allows you to reference the values of other variables within the JSON file.
44 44  
45 45  == Examples ==
46 46  
... ... @@ -58,7 +58,7 @@
58 58  
59 59  
60 60  {{code language="json"}}
61 -{ "var1": "value1", "var2": "${GetVar;inputFile}", "nestedVar": { "nestedVar1": "val1", "nestedVar2": "val2" } }
59 +{ "username": "john_doe", "email": "${GetVar;Email}", "isAdmin": "false", "nestedVar": { "nestedVar1": "val1", "nestedVar2": "val2" }}
62 62  {{/code}}
63 63  
64 64  
... ... @@ -65,7 +65,7 @@
65 65  == Important Notes ==
66 66  
67 67  * Variables set by SetVar can be referenced within the same JSON file or in subsequent scenarios.
68 -* Ensure proper syntax for dynamic values using ${GetVar;variableName}.
66 +* Ensure proper syntax for dynamic values using **${GetVar;variableName}**.
69 69  
70 70  == Conclusion ==
71 71  
This wiki is hosted and managed by iXPath
Powered by XWiki 13.3 debian