jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Liao, Avian" <al...@enporion.com>
Subject RE: Can variables be declared in BeanShell function?
Date Fri, 04 Feb 2005 23:39:21 GMT
Hi, Kyle, 

I don't know if the attachment will help you or not. The sample file is using Beanshell sampler,
and I don't know if that apply to your case or not. I did not get too deep for the beanshell
sampler, so.....well, just trying to help.

Avian

-----Original Message-----
From: Kyle McAbee [mailto:k.mcabee@treev.com]
Sent: Friday, February 04, 2005 3:10 PM
To: JMeter Users List
Subject: Can variables be declared in BeanShell function?


Dear JMeter Users:

Does anyone know whether BeanShell (current bsh-2.0b2.jar file) hosted by JMeter 2.0.2 will
allow a script to declare variables? The following BeanShell function fails.

${__BeanShell(String str1; String str2; str1 = "abc"; str2 = "def"; str1 = str1 + str2; return
str1.toString(); ) }

The same code put in a function in NetBeans 3.6 succeeds:

    private static String showConcatenation () {
        
        String str1; 
        String str2; 
        
        str1 = "abc"; 
        str2 = "def"; 
        str1 = str1 + str2; 

        return str1.toString(); 
    }

    public static void main(String[] args) {
         System.out.println(KillMeNow.showConcatenation());
}

Sincerely yours,

Kyle



Mime
View raw message