Forum Discussion

KeyofSea123's avatar
KeyofSea123
Contributor
11 years ago
Solved

[Res] Conditional Goto XPath Expression

I have a REST test case that sometimes returns
<m:message>(/var/www/html/websvc/actions/ZZZMF.php) errid (SQCSMF-110)QUOTE NOT SUBMITTED. Quote Header failed trying to populate and create in ZZZMF. Chain Message: (quote_order_hdr_post_ws) parameters:* (XWQC-QH-112) Party Bill_To Site does not exist for p_party_number=3143043 at line:671 in file:/var/www/html/websvc/actions/ZZZMF.php with code:0</m:message>
.
(ZZZ hides the call name.)

The party number would change so I was trying to match
*Party Bill_To Site does not exist*
like this
matches(//m:Quote_Create_Submit_Resp[1]/m:call_status[1]/m:message[1]/text(),'*Party Bill_To Site does not exist*')
.

This fails. So does
matches(//m:Quote_Create_Submit_Resp[1]/m:call_status[1]/m:message[1]/text(),'<m:message>(/var/www/html/websvc/actions/ZZZMF.php) errid (SQCSMF-110)QUOTE NOT SUBMITTED. Quote Header failed trying to populate and create in ZZZMF. Chain Message: (quote_order_hdr_post_ws) parameters:* (XWQC-QH-112) Party Bill_To Site does not exist for p_party_number=3143043 at line:671 in file:/var/www/html/websvc/actions/ZZZMF.php with code:0</m:message>')
even though that is the current result of the REST test step.

I need the Conditional Goto to run the REST test step again when that message is returned. Please help me with the proper XPath Expression.
  • This works!!
    declare namespace m='${#Project#Namespace}';
    contains(//m:Quote_Create_Submit_Resp[1]/m:call_status[1]/m:message[1]/text(),'Party Bill_To Site does not exist')

5 Replies

  • This works!!
    declare namespace m='${#Project#Namespace}';
    contains(//m:Quote_Create_Submit_Resp[1]/m:call_status[1]/m:message[1]/text(),'Party Bill_To Site does not exist')
  • nmrao's avatar
    nmrao
    Champion Level 3
    Please try with xpath
    contains(//m:message/text(),'Party Bill_To Site does not exist')

    should return true in your case.
  • I'm still getting
    No condition true for current response in [POST_Order_Detail_2]

    I had tried contains in several versions but didn't put that in my post.
  • It appears to be my namespace and not the XPath. I need to use the namespace from the project so I'll go figure that out.