Hum, I wonder if the parseInState that replaces the HTTP Return Code happens after the check of the HTTP-Response-Code for a valid value in the processing logic. Just a hunch....
As a simple test, try adding a Scriptable Assertion in the VS Image Selection step.
Run the VSM in ITR mode and send a request.
When the SI Selection step executes, CLICK on the Events tab and look for a log display produced by the Scriptable.
- Set your Scriptable Assertion to Fail the Test if the Return is False - a typo below will cause a failure.
import com.itko.util.ParameterList;
// get response meta data
ParameterList pl = lisa_vse_response.get(0).getMetaData();
// see if response code is found and print out some values
if ( pl.containsKey("HTTP-Response-Code") ) {
_logger.info("Response Meta contains an HTTP response code");
_logger.info("Response Code Value before parseInState is: {}", pl.get("HTTP-Response-Code") );
_logger.info("Response after parse in state is is: {}",
testExec.parseInState( pl.get("HTTP-Response-Code") );
} else {
_logger.info("HTTP-Response-Code was NOT FOUND in the VSI response Meta Data");
}
return true; // prevent failure if possible
The assertion only validates that the key is found and that data is in the field. We are simply trying to peek into what might be sent. The assertion does not set any values into the Response Code field.
It may be that you have to fire parseInState and manually set the actual parsed value into HTTP-Response-Code prior to the Responder step to return the desired response code.