However, I'm unable to get the desired response in assertion. I have used json extractor and given Name of created variable as : contenttype
Json path expression: $..contenttype
Default values: contenttype
And in the response assertion with pattern as substring I have given "contenttype":${contenttype}
But in results I am getting assertion fail message like test expected to contain /"contenttype:":VOD/
CodePudding user response:
We cannot help without seeing:
- The response (at least partial)
- Your
contenttype
variable value (can be visualized using Debug Sampler) - The placement of the Response Assertion (I'm talking about Scoping Rules)
So far I can only tell that:
The correct syntax for JMeter Variables is
${your-variable-name-here}
so you might want to change your expression to"contenttype":${contenttype}
If the value of the
contenttype
variable is supposed to be a String - in JSON it needs to be surrounded with quotation marks"contenttype":"${contenttype}"
If there are spaces around
:
like"contenttype" : "VOD"
your response assertion will fail