Trying to put some conditional logic in a script to only execute certain steps based on successful validation of a response assertion.
My script: Main execution thread
- Submit Http request
-- Response assertion code 200 (indicates request successfully submitted)
-- Response assertion contains string (I expect a specific string back if successful)
-- Json extractor (extract the string I tested for in the response for later use)
- Do a bunch of other stuff
My problem is that I only want to execute 'bunch of other stuff' if I get back the expected string (without it everything will fail anyway).
I need a conditional test to only execute if the second response assertion passed.
I've tried using "${JmeterThread.last_sample_ok}"
but this gives me an error of If controller: error while processing ... BAD CONDITION...expected true or false
I'm assuming I've placed the 'if' at the wrong point, or just used the condition inappropriately.
Any advice?
UPDATE:
My script currently looks like this:
- If test record is version 0
-- Send http to version 0 api
--- Response code assertion 200
--- Response assertion message contains specific string
--- Json extractor to extract the data associated with the string
-- If "${JmeterThread.last_sample_ok}"
--- Do other stuff
I'm assuming I've placed the If containing 'last sample ok' at the wrong level, or that the fact there's a json extractor as the last previous step that that has upset things.
You're making a mistake in case. Code is "case sensitive".
Here is how If Controller should be configured: