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

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:
- add
debug();statement 1st line of beanshell assertion , inspect stdout details 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) }- see how use beanshell: jmeter's favorite built-in component guide details on proper beanshell scripting in jmeter.
Comments
Post a Comment