user2880391
user2880391

Reputation: 2781

Jmeter Assertion failure reason

I'm running a test on Jmeter. this is part of the sampler result-

Load time: 520
Connect Time: 0
Latency: 520
Size in bytes: 504
Headers size in bytes: 458
Body size in bytes: 46
Sample Count: 1
Error Count: 1
Response code: 201
Response message: Created

so I have added 'Response Assertion' that configured as follows-

Apply to:Main sample only, Response Field to test:Response Code, Pattern Matching Rules:Equals, Patterns to test: 201.

when running it, the request fails and the reason is this:

Assertion error: false
Assertion failure: true
Assertion failure message: Test failed: code expected to equal /

****** received  : 201[[[  ]]]

****** comparison: 201[[[

]]]

/

What is exactly the problem?

Upvotes: 2

Views: 2426

Answers (2)

Harpreet Kaur
Harpreet Kaur

Reputation: 1

Problem Is

Assertion error: false
Assertion failure: true
Assertion failure message: Test failed: code expected to equal /
****** received  : 201[[[  ]]]

****** comparison: 201[[[

]]]
/

solution of problems:-

If you add link in Server Name or IP like this lifecharger.org/archives/ then need to change it to lifecharger.org

Add you link path in Path /archives/ then it will be work.

Thanks

Upvotes: 0

timbre timbre
timbre timbre

Reputation: 13960

I assume that in description you specified

Response Field to test:Response Message

by mistake, since the failure points to the fact that you compared Response code.

Given that, looks like you accidentally have newline character(s) after "201", which is(are) invisible, but cause comparison to fail. So just remove any spaces/newlines after "201". Make sure that Patterns to test is exactly 201, nothing else.

Upvotes: 1

Related Questions