Forum Discussion

vpnsingh2's avatar
11 years ago

How to handle dynamic responses in my Script assertion part

How to handle dynamic responses in my Script assertion part and Groovy Sciprt part?

groovyUtil.assertEquals(staticResponse, "//ns15:createAccountResponse/ns15:channelPhoneNumber"
,dynamicResponse, "//ns8:createAccountResponse/ns8:channelCarePhoneNumber" , "Verify channelPhoneNumber")

Here in the above script ns is getting changed in further releases. This is changing only in response not in request. Currently it ns15, in next release it will ns 22. I cannot change in my all scripts in all test cases. I need a solution that without using these ns I can get the value of this element. Like this there are 'n' no. of elements.

Also I used the WSDL Refactoring but that is useful only when my request is getting changed. Here in my case request is same while response is getting changed with new namespace.

1 Reply

  • Aks1982's avatar
    Aks1982
    Occasional Contributor
    Try regex..

    assert staticResponse =~ "//ns.*:createAccountResponse/ns.*:channelPhoneNumber"