I am writing testcases in CAPL and want to activate each test case by using "Button" from Panel Designer. The problem is that whenever I pressed the Button, it reacted as if it were pressed twice.
I just simply add a code like this to make that problem visible. (The system variable of "@sysvar::Test_Cases::TC1" is linked to the Button in the Panel Editor)
on sysvar sysvar::Test_Cases::TC1
{
putValueToControl("Window","CAPL Output View",@sysvar::Test_Cases::TC1);
}
I expect to see only --> Value of @sysvar::Test_Cases::TC1 =1
But the output is like this:
Value of @sysvar::Test_Cases::TC1 =1 Value of @sysvar::Test_Cases::TC1 =0
on sysvar X{...} event procedure reacts to value change of X.So in case of button press (0->1) value will be set to one then on button release (1->0) value will be set to zero, so you change the value of X twice. This is why you are getting trigger twice.
To react only once on such button press event, and get notification only once, please use the keyword this and condition statement.