Categories: java, performance, groovy, jmeter

Can we print success message/Assertion Result from Response Assertion in BeanShell PostProcessor using Jmeter?

1 answer

I am using 'BeanShell PostProcessor' to get the request and response data for generating the result file But I am not able to get the asseration result form Response assertion, Here I have added response assertion inside of sampler , i want to print that success message in logs
whether it is failed/pass like : Success message/Assertion result - True/False Please find the screen shot: enter image description here I will be able to print the all data in excel except 'Success Message(pass/fail)(true/false) Please find the screen shot : enter image description here

All answers to this question, which has the identifier 61228244

The best answer:

As per JMeter Test Elements Execution Order:

  1. Configuration elements
  2. Pre-Processors
  3. Timers
  4. Sampler
  5. Post-Processors (unless SampleResult is null)
  6. Assertions (unless SampleResult is null)
  7. Listeners (unless SampleResult is null)

You cannot get AssertionResult from the PostProcessor as the Assertion hasn't been executed yet, you need to switch to a Listener.

Also, forget about Beanshell, since JMeter 3.1 it's recommended to use JSR223 Test Elements and Groovy language, the relevant Groovy code to print Assertion results and failure messages to the jmeter.log file would be something like:

prev.getAssertionResults().each { assertionResult ->'Failure: ' + assertionResult.isFailure())'Failure message: ' + assertionResult.getFailureMessage()) } 


enter image description here

Last questions

how do i remove the switch on my home screen?
how to edit the JS date and time to update atuomatically?
How to utilize data stored in a multidimensional array
Powermockito not mocking URL constructor in URI.toURL() method
Android Bluetooth LE Scanner only scans when phone's Location is turned on in some devices
docker wordpress container can't connect to mysql container
How can I declare a number in java that is more than 64-bits? [duplicate]
Optaplanner solutionClass entityCollectionProperty should never return null error when simple JSON object passed to controller
Anylogic, get the time a pedestrain is in a queue
How do I fix this syntax issue with my .flex file?
Optimizing query in PHP
How to find the highest number of a column and print two columns of that row in R?
Ideas on “Error: Type is referenced as an interface from”?
JCIFS SmbFile.exists() and SmbFile.isDirectory() return false when it exists and I can listFiles()
PHP total order
Laravel booking system design
neural net - undefined column selected
How to indicate y axis does not start from 0 in ggplot?
Fragments in backStack
Spinner how to change the data