Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » RCP Testing Tool » [SOLVED] I cannot store result of the command to variable
[SOLVED] I cannot store result of the command to variable [message #1440470] Wed, 08 October 2014 12:01 Go to next message
Viktoriia Vlasiuk is currently offline Viktoriia VlasiukFriend
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 Go to previous messageGo to next message
Francis BACQUET is currently offline Francis BACQUETFriend
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 Go to previous messageGo to next message
Olga Yurchuk is currently offline Olga YurchukFriend
Messages: 245
Registered: September 2014
Senior Member

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.
Re: I cannot store result of the command to variable [message #1441823 is a reply to message #1440505] Fri, 10 October 2014 08:30 Go to previous messageGo to next message
Viktoriia Vlasiuk is currently offline Viktoriia VlasiukFriend
Messages: 4
Registered: October 2014
Junior Member
with -raw it works! Thank you Smile
Re: I cannot store result of the command to variable [message #1444051 is a reply to message #1441823] Mon, 13 October 2014 15:17 Go to previous message
Ivan Inozemtsev is currently offline Ivan InozemtsevFriend
Messages: 0
Registered: January 2015
Here's an extra information about get-property -raw vs just get-property https://www.eclipse.org/rcptt/documentation/faq/get-property-raw/
Previous Topic:[SOLVED] How can i exit proc before its end?
Next Topic:[SOLVED] rcptt strange lags
Goto Forum:
  


Current Time: Fri Apr 19 06:43:30 GMT 2024

Powered by FUDForum. Page generated in 0.01962 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top