Forum Discussion

MOTOROLA_Suppor_1's avatar
15 years ago

Xquery Reference testcase properties?

I just wonder if I could access testcase property '${#TestCase#PropertyName}' when performing XQuery Assertion ?

In XQuery Expression editor, i want to have somthing like. But I got an error. Is there a way to do it? thanks
sheena


===== Example of XQuery Expression==========
declare namespace ns2='http://asp.motorola.com/nbs/config/v1-0';
let $cur_length := count( //ns2:getManagedElementsResponse/attrContainerList/strAttribute)
where $cur_length < ${#TestCase#FullAttrLength}
return <Result>true</Result>

3 Replies

  • Hello,

    Property Expansions should work in XQuery Assertions. What is the error you're getting? Maybe you could also post the XML which you are running the query against?

    Regards,
    Dain
    eviware.com
  • pedro_carneiro's avatar
    pedro_carneiro
    Occasional Contributor
    i am having the same issue.

    my scenario is: <date name="original_date">2011-03-29T13:50:00Z</date>
    ${#TestCase#dateHourUTC} = 2011-03-28T13

    my xquery is the following:
    starts-with(//date[@name="original_date"]/text() , ${#TestCase#dateHourUTC} )

    the error i am getting is the following:
    XQuery Match Assertion failed for path [starts-with(//date[@name="original_date"]/text() , ${#TestCase#dateHourUTC} )] : RuntimeException:java.lang.reflect.InvocationTargetException

    i also noticed that if i use single or double quotes with the property soapui ALWAYS says that the assertion pass (success) although the expected result points to a failure.

    can you point it out what we are doing wrong?
  • Hi Pedro,

    hmm.. do you have any more error information in the error log at the bottom of the main soapUI window!?

    regards!

    /Ole
    eviware.com