question

GregM avatar image
GregM asked GregM posted

Member-of query

Lest I reinvent the wheel, I'll ask here...

 

I would like to create a query that checks that a given value appears in a list of values:

 

bool memberOf(value_to_test, list_of_values())

 

Is there a way to create such a thing in iTest with XPATH?

 

BTW, list_of_values() may return multiple instances of the same value.

iTestresponse map
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

GregM avatar image
GregM answered GregM posted

The attached response map illustrates how to implement the memberOf() query:

 

Definition:  count({0}[. = {1}])>0

Use:  memberOf("//list","//value")


memberOf.ffrm (2.6 KiB)
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

dclaar avatar image
dclaar Suspended answered dclaar Suspended posted
How flexible is the list of values, and how do you formulate it? Can you concat them, and then use Xpath string contains? Are they text nodes?
2 comments
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

GregM avatar image GregM commented ·

It's a raw list of supported firmware version with duplication and out of order:

 

v2.31 

v1.70

v1.72

v2.31

v2.40

 

 

0 Likes 0 ·
dclaar avatar image dclaar GregM commented ·
Yeah, but...raw list? tcl list? Or list as in the output of a command? If it is the output of a command, you can make it a table, and then use table/row [text="foo"] and count. Or define a block that matches v.\d+, and do a similar trick.
Message Edited by dclaar on 06-29-2009 02:21 PM
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.