// Sample BeanShell Assertion script // Derived from http://www.mail-archive.com/jmeter-user@jakarta.apache.org/msg05597.html if (ResponseCode != null && ResponseCode.equals ("200") == false ) { // this is standard stuff Failure=true ; FailureMessage ="Response code was not a 200 response code it was " + ResponseCode + "." ; print ( "the return code is " + ResponseCode); // this goes to stdout log.warn( "the return code is " + ResponseCode); // this goes to the JMeter log file } else { try { // non standard stuff where BeanShell assertion will be really powerful . // in my example I just test the size , but you could extend it further // to actually test the content against another file. byte [] arr = (byte[]) ResponseData ; // print ( arr.length ) ; // use this to determine the size if (arr != null && arr.length != 25218) { Failure= true ; FailureMessage = "The response data size was not as expected" ; } else if ( arr == null ) { Failure= true ; FailureMessage = "The response data size was null" ; } } catch ( Throwable t ) { print ( t ) ; log.warn("Error: ",t); } }