Forum Discussion

Usha_Kodali's avatar
Usha_Kodali
Frequent Contributor
15 years ago

xpath assertion

Hi,

I have data in a response as:

'Artist Name' and another element in same response as 'ArtistName'

I want to extract 'Artist Name' and verify that it matches with 'ArtistName'
I know that I need to split and then join 'Artist Name' element. I tried writing the logic in Xpath Assertion..but it complained saying split is not found....Can someone tell me how to achieve this?

3 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi Usha,

    can you show the actual xml response and your xpath expression?

    regards!

    /Ole
    eviware.com
  • Usha_Kodali's avatar
    Usha_Kodali
    Frequent Contributor
    Hi Ole,

    My Response is :

                       
                            2765
                           
                           
                            Soulja Boy ------ Artist Name
                            Gucci Bandana 
                            /swrv/Images/GameImages/BB_SouljaBoy_02.png ---ArtistName
                            1103
                            WebUser
                       

    As you see above, in the Name element I have value 'Soulja Boy' and in URL i have 'SouljaBoy'

    I want to check Name 'Soulja Boy' is part of URL.

    My Xpath expression:

    declare namespace aetgt='http://musicchoice.com/services/games';
    matches( //aetgt:GetGameMetaDataResponse[1]/aetgt:GetGameMetaDataResult[1]/aetgt:Contestants[1]/aetgt:Contestant[1]/aetgt:MetaData[1]/aetgt:EntrantInfo[1]/aetgt:Url[1]/text(), 'Soulja' )
    This works.

    I have 100 nodes of such type. So I want to get Name and split it and then join it and then assert that against URL.

    I actually want to use groovy scipt for this...i dont know groovy..