jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Bradley <adam_j_brad...@yahoo.com>
Subject Re: Variables - reassigning values to existing variables
Date Thu, 29 Jun 2006 15:13:15 GMT
> ---sample BeanShell code ---
> if (debug == "True")
>         log.info("Processing " + vars.get("MessageType") + " message")
> ---sample BeanShell code ---
> 
> The methods you'll most likely use are
> 
> vars.get
> vers.put
> and vars.remove
> 
> See http://jakarta.apache.org/jmeter/api/ for more information.

As with any Java code you'll still need to import classes if you
want to use methods they provide

---snip---
import org.apache.jmeter.threads.JMeterVariables;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jorphan.logging.LoggingManager;
import org.apache.log.Logger;
import org.apache.jmeter.protocol.ldap.sampler;

log.info("SampleResult Class " + SampleResult.Class);
log.info(SampleResult.getResponseDataAsString());

log.info("ResponseMessage Class " + ResponseMessage.Class);
log.info("ResponseMessage " + ResponseMessage);

log.info("SearchResult Class " + SearchResult.Class);
//log.info(SampleResult.getResponseDataAsString());

vars.put("testVar","surprise!");

Iterator i = vars.getIterator();
while(i.hasNext()) {
   Map.Entry me = i.next();
   if(String.class.equals(me.getValue().getClass()))
     log.info(me.toString());
}
---snip---

See if this works for you
Adam


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Mime
View raw message