[SOLVED] I cannot store result of the command to variable [message #1440470] |
Wed, 08 October 2014 12:01 |
Viktoriia Vlasiuk Messages: 4 Registered: October 2014 |
Junior Member |
|
|
I have the following code:
let
[val t1 [get-item "MGW" | get-property "caption" | equals "MGW"]]
[val t2 [get-item "MGW" | get-property "selected" | equals "true"]]
[val t3 [get-item "MGW" | get-property "image.path" | equals "test"]]
{
and [$t1][$t2][$t3]|verify-true
}
It does not work. Error:
Expected Boolean-convertible argument but got class org.eclipse.rcptt.tesla.ecl.model.impl.VerifyHandlerImpl
It works separately like: $t1 | verify-true
looks like the variables are not set to boolean, but definition of "equals" says it returns true or false. I want my test to contain 3 verifications and at the end fail the test if at least 1 verification failed.
Please help me to adjust my code.
thanks!
[Updated on: Wed, 30 September 2015 06:27] by Moderator Report message to a moderator
|
|
|
Re: I cannot store result of the command to variable [message #1440482 is a reply to message #1440470] |
Wed, 08 October 2014 12:30 |
Francis BACQUET Messages: 46 Registered: September 2014 |
Member |
|
|
Hello,
your problem, rcptt create VerifyHandler in t1, t2, t3. VerifyHandler isn't boolean.
You would same error with :
get-item "MGW" | get-property "caption" | equals "MGW" | bool
With boolean it's good:
let [val test "test"] {
let
[val t1 [$test | equals "test"]]
[val t2 [$test | equals "test"]]
[val t3 [$test | equals ""]]
{
and [$t1][$t2][$t3] | verify-true
}
}
How convert a verifyHandler in boolean...I don't know (just use "| verify-true" every variable).
Can you test with this code?
and [$t1][$t2][$t3] | foreach { verify-true }
[Updated on: Wed, 08 October 2014 12:41] Report message to a moderator
|
|
|
Re: I cannot store result of the command to variable [message #1440505 is a reply to message #1440482] |
Wed, 08 October 2014 12:57 |
|
Hi Victoriia,
By historical reasons, get-property command returns a special internal object VerifyHandler, which is later populated by commands like equals/matches/contains and processed by verify-true command (hence we can produce error messages more descriptive than 'expected true, but got false').
In order to get an actual property value, a '-raw' key can be used.
let
[val t1 [get-item "MGW" | get-property "caption" -raw | equals "MGW"]]
[val t2 [get-item "MGW" | get-property "selected" -raw | equals "true"]]
[val t3 [get-item "MGW" | get-property "image.path" -raw | equals "test"]]
{
and [$t1][$t2][$t3]|verify-true
}
Yours sincerely,
Olga.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01962 seconds