Forum Discussion

API-Tester's avatar
API-Tester
Occasional Contributor
8 years ago

Refactoring does not update namespace in XPath Assertion's Expected Result

Hello,

 

For many tests, I have used SoapUI Pro to create XPath assertions for entire nodes in the response. When asserting an entire node, rather than the individual elements, a namespace is inserted into the expected response. For example, when asserting the <DateListed> node, which includes elements for Day, Month, Year, and Unparsed, the expected result of the assertion is this:

 

<DateListed xmlns="myurl.com/Web.Services.Interfaces.9.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<Day>12</Day>
<Month>12</Month>
<Unparsed>12/12/2016</Unparsed>
<Year>2016</Year>
</DateListed>

 

The problem with this is that I test a versioned WSDL. If I attempt to refactor my 9.0 project to 10.0, the namespace in the expected result is not updated (the namespace in the actual XPath is updated), so the assertion fails because it is looking for 9.0 instead of the new 10.0. I have tried using wildcards, eg. xmlns="myurl.com/Web.Services.Interfaces.*.*

 

but this is not allowed in the namespace. Checking the box to ignore namespace prefixes also does nothing.

 

How can I resolve this?

1 Reply

  • PaulMS's avatar
    PaulMS
    Super Contributor

    Not sure if it is standard procedure, but you can open the project XML file in any text editor to replace all occurrences of "Interfaces.9.0" with "Interfaces.10.0". Obviously this assumes that the text you want to replace is only found in the assertions that should be updated.