Getting Custom Validations to Work

46 views
Skip to first unread message

Jason Finch

unread,
Mar 16, 2018, 2:25:45 PM3/16/18
to Gatling User Group
Hello, 

   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

konzinov maverick

unread,
Mar 22, 2018, 10:38:11 AM3/22/18
to Gatling User Group
Hello.
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
Reply all
Reply to author
Forward
0 new messages