How to use json path assertion in jmeter

Json path Assertion in jmeter, the assertion is checked or test a statement or condition and result will be true or false. if result gets true request test will pass else it will fail. json path assertion is one of kind assertion it will use when we are getting json response it will have mostly when we test rest API.

See howto use json path assertion

Step 1

Add thread group

Step 2

Add json type request.

if you want to use assertion on particular API right click on the API go to the assertion and add
json path assertion.

if you want to use json path assertion in all API right click on the API and go to the assertion and add
json path assertion.

currently, I am using this assertion to all API and  Before use assertion first see the response of json request .. then you can configure your json assertion and currently, I am checking that success should be true else API test will fail and structure will be { success : true means it’s the first parent so start with $. and type the attribute name like success and expected value in a text field. check on validating against expected value or you can also text as a regular expression.

if you want to check the message then you should pass “$.data.message” and expected value let’s run only one API should pass cause I apply this test to all APIs. only one API is passed else fail so you can follow this configuration in parent-child and use with a dot.

if you want to use as reverse means the message if come it should fail.

click on invert selection checkbox

if you want to check if the attribute should come as null then check on expect null.