cancel
Showing results for 
Search instead for 
Did you mean: 

soapui 2.5 'assertion for content' not working.

Super Contributor

soapui 2.5 'assertion for content' not working.

Hello,
I am trying to create a 'assertion of content' by comparing an elementA  from the response of step B to elementA of StepA. the values of the both the elementA is the same but the assertion fails with the following message.

XPathContains comparison failed, expecting [], actual was [3854868]

My Xpath Expression and Excpected Results is follows
declare namespace ns1='http://services.tvguide.com/v6/smartrecommendations';
//ns1:GetRecommendationsResponse[1]/ns1:GetRecommendationsResult[1]/ns1:Programs[1]/ns1:Program[1]/ns1:ProgramId[1]/text()


Expected Result
${GetRecommendations - No Usage Data#Response#//ns1:GetRecommendationsResponse[1]/ns1:GetRecommendationsResult[1]/ns1:Programs[1]/ns1:Program[1]/ns1:ProgramId[1]}


If I plugin 3854868 directly into Expected result, the assertion passes


Ali
7 REPLIES 7
Super Contributor

Re: soapui 2.5 'assertion for content' not working.

This does not seem to happen on all test steps. I am able to create these kinds of assertions on some other test steps.

Ali
Super Contributor

Re: soapui 2.5 'assertion for content' not working.

Hi Ali,

hmm.. maybe this is a namespace or prefix issue in the expected results' xpath expression? Could you try changing it to

${GetRecommendations - No Usage Data#Response#declare namespace ns1='http://services.tvguide.com/v6/smartrecommendations';//ns1:GetRecommendationsResponse[1]/ns1:GetReco...

?

regards,

/Ole
eviware.com
Super Contributor

Re: soapui 2.5 'assertion for content' not working.

This seems to work. Is this a bug ?
Super Contributor

Re: soapui 2.5 'assertion for content' not working.

Hi,

no, not really.. the previous version expects a certain namespace prefix usage in the response message, this one will work with any one..

regards,

/Ole
eviware.com
Super Contributor

Re: soapui 2.5 'assertion for content' not working.

I am not sure what you mean.
If I have to manually enter the namespaces in the expected results, then how is this not a bug ?
If there is no namespace prefix, then soapui does not seem to interpret the xpath expression in some cases.

Thanks

Ali
Super Contributor

Re: soapui 2.5 'assertion for content' not working.

Hi Ali,

hm... When specifying an xpath-expression without a namespace declaration, soapUI will internally build a list of all namespaces available in the response and then assign them to sequentially generated namespace prefixes. In the process it will try to retain prefixes used in the message but there is no guarantee that this will succeed; in your case I am guessing that this algorithm is failing to assign the prefix "ns1" to your namespace for some reason, which will result in this behavior.

You are correct though, there might be room for improvement here.. if you can show the actual response message that will not work with your initial version I can check it out!

regards!

/Ole
eviware.com
Super Contributor

Re: soapui 2.5 'assertion for content' not working.

Xpath Expression:
declare namespace ns1='http://services.tvguide.com/v6/smartrecommendations';
//ns1:GetRecommendationsResponse[1]/ns1:GetRecommendationsResult[1]/ns1:Programs[1]/ns1:Program[1]/ns1:ProgramId[1]/text()

Expected Result:
${GetRecommendations - No Usage Data#Response#//ns1:GetRecommendationsResponse[1]/ns1:GetRecommendationsResult[1]/ns1:Programs[1]/ns1:Program[1]/ns1:ProgramId[1]}

Actual Response

 

      http://services.tvguide.com/v6/smartrec ... nsResponse
      urn:uuid:7b3ff294-6f69-446f-9a08-173219e70d03
      urn:uuid:1e73d046-c88b-40be-b8bd-2a51685741e9
      http://schemas.xmlsoap.org/ws/2004/08/a ... /anonymous
     
       
            2009-01-08T19:45:34Z
            2009-01-08T19:50:34Z
       

     

 

 
     
       
            3cf36769-5284-4134-83ad-ae366f3151de
            gero et
            2009-01-08T19:45:33Z
            PNE
           
           
             
                  4274815
                  0
                  0
                  Resumen Especial Maratón del Atlas
                 
                 
                  30
                  One Time Only
                  Sports
                 
                  0
                 
                 
                  0
                  0
                  0
                  None
                 
                  false
                  false
                  false
                  Color
                 
                  false
                 
                    sports stuff
                 

                 
                 
                 
             

           

           
           
              1
              0
              18
             
                  3
             

           

       

     

 
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors