Forum Discussion
MERKSEN
12 years agoNew Contributor
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.
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.
Related Content
- 6 years ago
- 5 years ago
- 2 years ago
- 2 years ago
Recent Discussions
- 2 hours ago
- 16 days ago