Reputation: 217
I am getting Json response, I have parsed it using jp@gc - JSON Path Extractor and got an element say 'Access_Token'. This Access_Token is dynamic. So I just want to make sure that this element is not null.
Any leads would be much appreciated.
Upvotes: 0
Views: 7079
Reputation: 34526
Since JMeter 3.0 there is a new JSON Path Processor that you should use instead of the JMeter Plugins one.
See its features in action here:
You can then apply Dmitri T. answer.
Upvotes: 1
Reputation: 168072
In the JSON Path Extractor provide Default Value, for example NOT_FOUND
Add Response Assertion after the JSON Path Extractor and configure it as follows:
See How to Use JMeter Assertions in Three Easy Steps article for comprehensive information on using Assertions in JMeter scripts.
Upvotes: 7
Reputation: 1200
Add a BeanShell PostProcessor component after you get your Access_Token and in it check what you want...
if (vars.get("Access_Token") != null) {
// do something
} else {
// do something else
}
Depending on your needs, you can do basically what ever you want from here. For example stop the thread, stop the test...
Upvotes: 1