Failing assertion, can't understand why or how to fix it?!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Failing assertion, can't understand why or how to fix it?!
I am placing assertions against a JSON response, by right clicking the response and "Add Assertion > for Content"
Initially the assertion passes as expected. But items I created on Friday are failing on Monday. I've looked a dozen times and the fact is the response is 100% identical to to the expected assertion value. I've even used BeyondCompare to verify as well as Notepad++ to verify the text, carriage returns and line feeds are exactly the same. I don't understand how this can initially pass then not pass when the value returned as not changed.
I can't post the actual value due to complaince and security reasons so I will post an example response in hopes that this can be understood. The response is as follows (Note the CR/LF after Name):
RIVERSIDE-TN
SSN / ITIN: xxx-xx-xxxx
dba Example Company Name
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @Jason_S,
If you think that this response will never get changed, try adding contains assertion manually from the Bottom Assertion TAB and writing your expected over there.
Do Like and Accept if you find it as Solution.
Thanks,
Himanshu Tayal
Click "Accept as Solution" if my answer has helped,
Remember to give "Kudos" 🙂 ↓↓↓↓↓
Thanks and Regards,
Himanshu Tayal
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I thought about that, but to be honest I really don't feel that's the appropriate answer.
In our business validating exact information is pretty crucial and I think using a contains would allow for additional information to technically pass. This information is likely to not change, but I cannot say with 100% certainty that it will never change. I would really like to understand why this is failing so that I, or someone, can correct this issue.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
so in that case use jsonslurper for validating your response.
Go through groovy-slurping-json-in-script-assertions/
Do like and accept if you find it as solution.
Thanks,
Himanshu Tayal
Click "Accept as Solution" if my answer has helped,
Remember to give "Kudos" 🙂 ↓↓↓↓↓
Thanks and Regards,
Himanshu Tayal
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How about using regex?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have exact same situation as Jason and would like to understand why it happens and is there any way to fix this problem.
