Search code examples
jsonjmeterassertions

jmeter assertion to validate json schema


I'm currently testing a web application which outputs json. I want to make sure that the JSON is valid. I do not want to validate its content. How can I implement a assertion in jmeter to make sure that the json response is valid?

Thanks!


Solution

  • Use beanshell assertion, jsr223 assertion or bsf assertion if you want to use groovy:

    and parse the response using some json parser:

    Jmeter will provide to your script the previous sampler response as a script variable.

    Note that this can impact performance of your test plan as it's rather costly.

    Regards