Krishnakant Mahamuni
Krishnakant Mahamuni

Reputation: 73

Jmeter 5.4.1 failing for 204 response

one of my services are returning the below response

Thread Name:User Registration 1-1
Sample Start:2021-04-13 22:26:37 AEST
Load time:1223
Connect Time:0
Latency:0
Size in bytes:118
Sent bytes:1006
Headers size in bytes:118
Body size in bytes:0
Sample Count:1
Error Count:1
Data type ("text"|"bin"|""):
Response code:204
Response message:No Content


HTTPSampleResult fields:
ContentType: 
DataEncoding: null

And Jmeter marks it as failed. Note there is no explicit Response Assertion added.

The default assertion result is as below.

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

****** received : 20[[[4]]]

****** comparison: 20[[[0]]]

/

not sure why Jmeter is comparing the result with 200 without I specifying the

enter image description here

Upvotes: 0

Views: 490

Answers (1)

Dmitri T
Dmitri T

Reputation: 168002

JMeter Assertions obey JMeter Scoping Rules therefore even if you don't have assertion added directly as a child of a Sampler but the Sampler is in scope of an Assertion - the assertion will be applied to the sampler (and in fact to all Samplers in its scope)

enter image description here

So make sure to double check your Test Plan and see if there are any Response Assertions which check response code to be 200

If there is one - be aware that you can configure it to accept both 200 and 204 statuses

enter image description here

Upvotes: 1

Related Questions