How to get the Response Message and Response Code when the Assertion Fails in jmeter -


i working on webservice testing using jmeter.i using beanshell assertion in trying display response code , response message problem when request fails unable response code|message displayed on jmeter log file.in case if proper response getting response code|message properly.is there solution response code|message when request fails in jmeter beanshell assertion

perhaps wrong beanshell code beanshell assertion should handle parent sampler failure

beanshell assertion example

the code produced these log lines looks simple as:

stringbuilder sb = new stringbuilder(); sb.append("sampler: "); sb.append(sampleresult.getsamplelabel()).append(" "); sb.append("successful: "); sb.append(sampleresult.issuccessful()).append(" "); sb.append("code: "); sb.append(responsecode).append(" "); sb.append("message: "); sb.append(responsemessage);  log.info(sb.tostring()); 

few tips:

  1. add debug(); statement 1st line of beanshell assertion , inspect stdout details
  2. surround code in try/catch block , in catch block print exception jmeter.log file as

    try {     //your beanshell assertion code here } catch (throwable ex) {     log.error("something went wrong", ex) } 
  3. see how use beanshell: jmeter's favorite built-in component guide details on proper beanshell scripting in jmeter.

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -