Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

How do I replacing null in beanshell by empty string

$
0
0
Hi,

I'm getting the following response from a server (the actual response
contains almost 50 variables):

/var s0={};var s1="John Allen";s0.firstnames=s1;var s2=null;s0.prefix=s2;var
s3="Doe";s0.lastname=s3;
DWREngine._handleResponse('97_1420006799508', s0);/

I'm using BSF PostProcessor to put all the variables in JMeter variables
with the following code:

/var person = null;

function dwrPrototype () {
this._handleResponse = function(handle,myObject){
person = myObject;
};

var DWREngine = new dwrPrototype();

(new Function(prev.getResponseDataAsString())())

vars.put("firstnames",person.firstnames);
vars.put("firstnames",person.prefix);
vars.put("firstnames",person.lastname); /

In the Results Tree I the following response data for a Debug Sampler:
firstnames=John Allen
prefix=null
lastname=Doe

If I use the variable prefix later on in a field, the request fails because
it contains ${prefix} instead of null.
I would rather have and empty string ("") filled in the field.

How do I do this?

Viewing all articles
Browse latest Browse all 5648

Trending Articles