[bug]: keploy test prints "Testrun passed" for a test case whose assertion fails
Is there an existing issue for this?
- I have searched and didn't find similar issue
Current behavior
Match compares the response and prints the "Testrun passed" or "Testrun failed" banner, with the diff table on a fail, before it checks tc.Assertions and returns AssertionMatch's verdict. So the banner is about the response comparison while the verdict comes from the assertions, and they can disagree. A test case whose status_code assertion fails on a response that matches the recording prints "Testrun passed" and then shows up as failed, and a passing assertion on a drifted body prints "Testrun failed" with a diff for a test case that passes. I found it with a test that captures what Match prints, not from a real app run, but compareHTTPRespForReplay falls through to a Match with logs on whenever the quiet match fails, so I think the "Testrun passed" one shows up on a normal keploy test run.
Steps to Replicate
- Make a test case with a recorded
200response, body{"a":1}, and the assertionstatus_code: 500. - Call Match with an actual
200response and body{"a":1}, with emitFailureLogs true. - It prints
Testrun passed for testcase with id: ...and returns false. With the assertion set tostatus_code: 200and an actual body of{"a":2}, it printsTestrun failedwith a diff and returns true.
Operating system
MacOS
Version
main at 4800a30
Repository
keploy
Source: keploy/keploy