jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nirodha Pramod <niro...@wso2.com>
Subject Re: How to invoke a java method
Date Fri, 24 Feb 2012 20:42:49 GMT
Hi,

After creating a jar this worked. Now I want to get the return value("true"
or "false") of the method call and pass it as the response of the sample.
And I want assert it using a response assertion. How can I set that return
value as the sample response within beanshell?

Thanks

On Thu, Feb 23, 2012 at 6:07 PM, Nirodha Pramod <nirodha@wso2.com> wrote:

>
>
> On Thu, Feb 23, 2012 at 5:46 PM, sebb <sebbaz@gmail.com> wrote:
>
>> On 24 February 2012 01:36, Nirodha Pramod <nirodha@wso2.com> wrote:
>> > Hi,
>> >
>> >
>> > On Thu, Feb 23, 2012 at 4:07 PM, sebb <sebbaz@gmail.com> wrote:
>> >
>> >> On 23 February 2012 23:37, Nirodha Pramod <nirodha@wso2.com> wrote:
>> >> > Hi,
>> >> >
>> >> > I want to test a session enabled axis2 service with Jmeter. There's
>> an
>> >> > special java client have written to test this. I want invoke that
>> class
>> >> > within jmeter.I tried with BShell sampler. But I get an error when
>> the
>> >> test
>> >> > starts.
>> >> >
>> >> > ERROR - jmeter.util.BeanShellInterpreter: Error invoking bsh method:
>> >> eval In
>> >> > file: inline evaluation of: ``import java.text.SimpleDateFormat;
>> import
>> >> > java.util.Calendar; import java.util.H . . . '' Encountered "," at
>> line
>> >> > 116, column 23.
>> >>
>> >> So what is at line 116?
>> >>
>> >
>> > Inside beanshell line 116 is,
>> >
>> > Map<String, String> contextMap = new HashMap<String, String>();
>> >
>>
>> I don't think BeanShell supports generics.
>>
>> >
>> >>
>> >> > Is there any other sampler I can use for this?
>> >>
>> >> Not without writing some Java code.
>> >>
>> >> You could use the Java Sampler - this would mean implementing the
>> >> appropriate interface.
>> >>
>> >> It's possible to use BeanShell to write very complicated scripts, but
>> >> they can be tricky to debug.
>> >>
>> >> I suggest you write a wrapper for the test code that you can just call
>> >> as a method that returns a string.
>> >>
>> >> So the BeanShell code would just be:
>> >>
>> >> return perform_sample(p1, p2, p3);
>> >>
>> >
>> > So lets say My class is 'SessionClient' and the method is 'execute' .
>> Do I
>> > have to create a object of that class inside beanshell and invoke
>> > 'execute'.? Or else how should I do it?
>>
>> Depends on whether the method is static or not.
>>
>> How would you do it in Java?
>>
>
> Got it. Thanks
>
>>
>> >>
>> >> The method should accept string parameters for all the items that need
>> >> to vary between tests.
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
>> >> For additional commands, e-mail: user-help@jmeter.apache.org
>> >>
>> >>
>> >
>> >
>> > --
>> > *Nirodha Gallage*
>> > Software Engineer, QA.
>> > WSO2 Inc.: http://wso2.com/
>> > Email: nirodha@wso2.com   Mobile: +94716429078
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
>> For additional commands, e-mail: user-help@jmeter.apache.org
>>
>>
>
>
> --
> *Nirodha Gallage*
>
> Software Engineer, QA.
> WSO2 Inc.: http://wso2.com/
> Email: nirodha@wso2.com   Mobile: +94716429078
>
>


-- 
*Nirodha Gallage*
Software Engineer, QA.
WSO2 Inc.: http://wso2.com/
Email: nirodha@wso2.com   Mobile: +94716429078

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