Getting Custom Validations to Work


I have reviewed the Gatling validations page, but I don’t understand exactly how to implement it for my use case. I have a Scala function ‘def isValidJSON ()’ that returns true if the JSON for a previous http request is valid and false if not. I can’t seem to find out how to use this function I built to serve as validator in the flow of my Gatling test. Right now I have it assigning the result of the function to a session variable, but haven’t been able to use it to trigger a test failure. I don’t know if anyone has any concrete suggestions.

Thank You

Validator[T] is a trait. So your isValidJson must return an instance of it in which you will implement methods name and apply. Then the result can be reused to perform validation in gatling check method