Bryan_Nahrwold
16 years agoContributor
asserting and xml response against a property expansion
First, let me say that your documentation is very extensive but difficult to implement. Your docs may work well for people well versed in soap but for those of us trying to adopt this technology, this is very frustrating. You give details about inserting code but you fail to give the details of exactly where to insert code you are recommending. Most of use don't have time to reverse engineer your recommendations. Explicit details would be greatly appreciated.
Anyway, here is my issue:
I have a test cases created from soap operations that Set and then Get proxy information from parameters that are populated from properties imported from an external file.
The test steps for these Set/Get operations are in different test cases for a reason I don't want to take time to explain but please don't recommend using a signle test case with multiple test steps because that worn't work for my test.
Anyway, one of the property expansions used is :${ProxyProperties#proxyaddress}. There are more, but we can focus on this one because whatever works for it will work for the rest.
The GetProxyInfo operation returns the following:
<?xml version="1.0" encoding="UTF-8"?>
<proxyinfo address="slc-labproxy.test.lab" host="" password="*******" port="8080" requiresLogin="false" useProxy="true" userID=""/>
If I try to create a property for this output, it creates:
declare namespace ns1='http://amp.avocent.com/licensing';
//ns1:GetProxyInfoResponse[1]/ns1:out[1]/text()
which does not give me granular control over comparing the individual parameters of the response.
I need this granular control because sometimes some of the returned values will be empty and sometimes not (depending on whether or not I select "requireslogin")
The first problem with this is, I no sooner create this, using soapUI, than I get the error:
XPathContains assertion failed for path [declare namespace licact='http://amp.avocent.com/licensing';
//licact:GetProxyInfoResponse[1]/licact:out[1]/text()] : Exception:org.custommonkey.xmlunit.Diff
[different] Expected namespace URI 'null' but was 'http://amp.avocent.com/licensing' - comparing at /proxyinfo[1] to at /out[1]
I get this error as soon as I create the Property Transfer or Property( I can't remember which). As this pertains to the source, why is the XPath, CREATED BY soapUI, producing an error? shouldn'tt your code create this XPath so that it passes your validation?
As a result, I tried another approach. I created a second Assert "for Content matching RegEx" and this one passed immediately, so I decided to focus my efforts on this Assert.
It create a Declare section:
declare namespace soapenv='http://schemas.xmlsoap.org/soap/envelope/';
//soapenv:Envelope[1]
And an Expected Result section:
<?xml version="1.0" encoding="UTF-8"?>
<proxyinfo address="slc-labproxy.test.lab" host="" password="*******" port="8080" requiresLogin="false" useProxy="true" userID=""/>
I have selected "Allow Wildcards" and tried to change:
address="slc-labproxy.test.lab"
to
address=*
or
address="*"
or
address=${ProxyProperties#proxyaddress}
or
address="${ProxyProperties#proxyaddress}"
In all cases, the Match content fails as soon as I change it, but passes as long as it contains:
address="slc-labproxy.test.lab"
What is the best way to perform an assertion that allows me to specify the result of the GetProxyInfo TestCase and compare it against the PropertyExpansion I created in an earlier testCase?
Thanks.
Anyway, here is my issue:
I have a test cases created from soap operations that Set and then Get proxy information from parameters that are populated from properties imported from an external file.
The test steps for these Set/Get operations are in different test cases for a reason I don't want to take time to explain but please don't recommend using a signle test case with multiple test steps because that worn't work for my test.
Anyway, one of the property expansions used is :${ProxyProperties#proxyaddress}. There are more, but we can focus on this one because whatever works for it will work for the rest.
The GetProxyInfo operation returns the following:
<proxyinfo address="slc-labproxy.test.lab" host="" password="*******" port="8080" requiresLogin="false" useProxy="true" userID=""/>
If I try to create a property for this output, it creates:
declare namespace ns1='http://amp.avocent.com/licensing';
//ns1:GetProxyInfoResponse[1]/ns1:out[1]/text()
which does not give me granular control over comparing the individual parameters of the response.
I need this granular control because sometimes some of the returned values will be empty and sometimes not (depending on whether or not I select "requireslogin")
The first problem with this is, I no sooner create this, using soapUI, than I get the error:
XPathContains assertion failed for path [declare namespace licact='http://amp.avocent.com/licensing';
//licact:GetProxyInfoResponse[1]/licact:out[1]/text()] : Exception:org.custommonkey.xmlunit.Diff
[different] Expected namespace URI 'null' but was 'http://amp.avocent.com/licensing' - comparing
I get this error as soon as I create the Property Transfer or Property( I can't remember which). As this pertains to the source, why is the XPath, CREATED BY soapUI, producing an error? shouldn'tt your code create this XPath so that it passes your validation?
As a result, I tried another approach. I created a second Assert "for Content matching RegEx" and this one passed immediately, so I decided to focus my efforts on this Assert.
It create a Declare section:
declare namespace soapenv='http://schemas.xmlsoap.org/soap/envelope/';
//soapenv:Envelope[1]
And an Expected Result section:
<proxyinfo address="slc-labproxy.test.lab" host="" password="*******" port="8080" requiresLogin="false" useProxy="true" userID=""/>
I have selected "Allow Wildcards" and tried to change:
address="slc-labproxy.test.lab"
to
address=*
or
address="*"
or
address=${ProxyProperties#proxyaddress}
or
address="${ProxyProperties#proxyaddress}"
In all cases, the Match content fails as soon as I change it, but passes as long as it contains:
address="slc-labproxy.test.lab"
What is the best way to perform an assertion that allows me to specify the result of the GetProxyInfo TestCase and compare it against the PropertyExpansion I created in an earlier testCase?
Thanks.