jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryszard Łach <ryl...@gmail.com>
Subject Re: Removing variables
Date Thu, 03 Dec 2009 08:36:47 GMT
2009/12/1 Deepak Shetty <shettyd@gmail.com>

> Hi
> if you want to clear all variables, its simple to do this in
> beanshell.(JMeterVariables -
>
> http://jakarta.apache.org/jmeter/api/org/apache/jmeter/threads/JMeterVariables.html
> lets you get all the variables and you can loop over the key names and
> remove them)
> If you wanted to clear a subset , then I'd probably go with a naming
> convention (all variables to be cleared will be prefixed with clr_ and
> write
> a beanshell script to iterate and remove variables satisfying the
> condition)
> regards
>

Thanks a lot, with little help of java programmer it works perfectly!

Here is the script:

copy = new HashSet(vars.entrySet());
for (Iterator iter = copy.iterator(); iter.hasNext();) {
    e = iter.next();
    if ( e.getKey().startsWith("prefix") ) {
        vars.remove(e.getKey());
    }
}


-- 
"First they ignore you. Then they laugh at you. Then they
fight you. Then you win." - Mohandas Gandhi.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message