Why "JMeterThread.last_sample_ok" is set to true on assertion failure

11,592

For my Apache JMeter 2.11 everything works as expected.

I'm using ${JMeterThread.last_sample_ok}==false condition in If Controller

Looking into Debug Sampler and View Results Tree Listener combination I can that "JMeterThread.last_sample_ok" variable value is "false" for the sampler, failed by an assertion.

Debug Sampler

So double check your clause in If Controller and perhaps perform a dry run with Debug Sampler and View Results Tree listener enabled. Check out How to debug your Apache JMeter script for details on JMeter script debugging techiques.

Share:
11,592

Related videos on Youtube

Michael S Daniel
Author by

Michael S Daniel

Updated on June 04, 2022

Comments

  • Michael S Daniel
    Michael S Daniel almost 2 years

    The jmeter document says

    http://jmeter.apache.org/usermanual/component_reference.html#assertions

    The variable JMeterThread.last_sample_ok is updated to "true" or "false" after all assertions for a sampler have been run.

    I have a http sampler in my test plan which performs a login with couple of redirects.

    Interestingly I find that JMeterThread.last_sample_ok is set true even after my assertion fails. I am using response assertion to assert a string after login. The variable is set true even when assertion fails. This causes the next "if controller" to proceed for the wrong responses as well. Am I missing some thing.

    Thanks in Advance for your help.