Contributions
- 12 years agoPlace ReadyAPI QuestionsReadyAPI Questions3.1KViews0likes0Comments
Re: [Res] JDBC-datasource and XPATH, problems comparing []...
No, it doesn't help me, it's not the empty elements as such I'm interested in. I'm doing datadriven testing, and need my assertions to work for entries that do and do not contain optional data, email in the example. Datasource: (The database the service is using) Select PERSON.ID As PERSON.ID, PERSON_NAME As PERSON_NAME, PERSON.EMAIL As PERSON_EMAIL From PERSON Id Name Email 123 Carl carl@test.com 124 Steve (null) Assertion: ${database#PERSON_EMAIL} 1. Correct response ReadPerson(123) <ReturnValue> <Id>123</Id> <Name>Carl</Name> <Email>carl@test.com</Email> <ReturnValue> 2. Correct response (no email supplied) ReadPerson(124) <ReturnValue> <Id>124</Id> <Name>Steve</Name> <Email/> <ReturnValue> 3. Incorrect response (incorrect email) ReadPerson(123) <ReturnValue> <Id>123</Id> <Name>Carl</Name> <Email>24 Carl Street</Email> <ReturnValue> So, I do want the assertion to test the content of Email and conclude that 1 is correct and 3 is not, but I don't want it to give me an error for 2: XPathContains comparison failed, expecting [], actual was [null] Not sure if I make sense, this all seems so very basic to me and still I can not make it work.12 years agoPlace ReadyAPI QuestionsReadyAPI Questions3.1KViews0likes0Comments[Res] JDBC-datasource and XPATH, problems comparing []...
The jdbc-datasource I use sometimes contains null values, like in this simplified example: Id Name Email 123 Carl carl@test.com 124 Steve (null) When called, the SOAP-service I am testing returns empty elements, like this: -> ReadPerson(124) <- <ReturnValue> <Id>124</Id> <Name>Steve</Name> <Email/> <ReturnValue> I want to treat this as the expected result, but my XPATH-match: declare namespace ns1='http://test.com/Person; //ns1:GetPersonResponse[1]/ns1:GetPersonResult[1]/ns1:ReturnValue[1]/ns1:Email[1] says: XPathContains comparison failed, expecting [], actual was [null] ([] [null] seems backwards to me, but it's what it says) I want [] to equal [null], how can I do this?12 years agoPlace ReadyAPI QuestionsReadyAPI Questions6.6KViews0likes7Comments