2009/12/1 Deepak Shetty <shet...@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.

Reply via email to