user1484852
user1484852

Reputation: 31

Want to check for assertion failure in Jmeter

I am a beginner in JMeter. I want to check for Assertion Failures in my script. I want to continue my transaction for a number of iterations after a single log in attempt, and I want to log out only if an error occurs. For that, I want to check if an error occurred in the script.

Is it possible by comparing assertions in JMeter?
If not, is there are any other way to find that?

Upvotes: 1

Views: 6005

Answers (2)

eugene.polschikov
eugene.polschikov

Reputation: 7339

In addition to the answer above I would recommend you:

  • Add error checking to your script - assertions that the responses are valid for a given reques
  • Use Firebug to view network traffic when you need to debug your test script
  • Use a regular expression extractor to retrieve a dynamic value from a response and re-use it in a later request

To get the idea you can follow JMeter error checking video tutorial.

FYI: Assertion details provided. Hope this helps.

Upvotes: 1

Aliaksandr Belik
Aliaksandr Belik

Reputation: 12873

Define first indicator(s) that will mark response as erratic (Response Code, keyword, etc.).

Try to use Response Assertion to handle state of your request (success/failure) depending on indicators above and then use IfController along with pre-defined JMeterThread.last_sample_ok jmeter's variable - whether or not the last sample was OK - true/false.

Schema will look like below e.g.:

ThreadGroup
    LOGIN REQUEST
    ...
    YOUR HTTP REQUEST HERE
        Response Assertion
        Response Field to Test: Response Code
        Pattern Matching Rules: NOT Equals
        Patterns to Test: 200
        Regex Extractor
    IfController
    Condition: ${JMeterThread.last_sample_ok}   // will be TRUE if Response Assertion above is TRUE (i.e. response code != 200)
        LOGOUT REQUEST
    ...

Upvotes: 3

Related Questions