I have test code that should result in only one true but results in two trues.
Steps:
-
Execute code.
-
Examine the values of these three variables:
if_matched
else_matched
elseif_matched
On executing the test code, the erroneous result is:
if_matched = true
elseif_matched = false
else_matched = true
With an if-then-else structure, the correct result should be:
if val is 1 then
if_matched = true
elseif_matched = false
else_matched = false
I’m running UI.Vision in Chrome Browser.
Test Code Follows
Contents of “Try Out Commands”
Begin ===========================
{
"Name": "Try out commands",
"CreationDate": "2020-1-26",
"Commands": [
{
"Command": "store",
"Target": "false",
"Value": "if_matched"
},
{
"Command": "store",
"Target": "false",
"Value": "elseif_matched"
},
{
"Command": "store",
"Target": "false",
"Value": "else_matched"
},
{
"Command": "store",
"Target": "1",
"Value": "val"
},
{
"Command": "if_v2",
"Target": "${val} == \"1\"",
"Value": ""
},
{
"Command": "store",
"Target": "true",
"Value": "if_matched"
},
{
"Command": "run",
"Target": "Sub_R",
"Value": ""
},
{
"Command": "elseif",
"Target": "${val} == \"2\"",
"Value": ""
},
{
"Command": "store",
"Target": "true",
"Value": "elseif_matched"
},
{
"Command": "run",
"Target": "Sub_R",
"Value": ""
},
{
"Command": "else",
"Target": "",
"Value": ""
},
{
"Command": "store",
"Target": "true",
"Value": "else_matched"
},
{
"Command": "end",
"Target": "",
"Value": ""
}
]
}
End ===========================
Contents of “Sub_R”
Begin ===========================
{
"Name": "Sub_R",
"CreationDate": "2020-1-26",
"Commands": [
{
"Command": "pause",
"Target": "200",
"Value": ""
}
]
}
End ===========================