sebb-2-2 wrote: > > On 7 January 2011 03:34, zhouyuan <[email protected]> wrote: >> >> >> sebb-2-2 wrote: >>> >>> On 6 January 2011 16:40, zhouyuan <[email protected]> wrote: >>>> >>>> >>>> sebb-2-2 wrote: >>>>> >>>>> On 6 January 2011 15:42, zhouyuan <[email protected]> wrote: >>>>>> >>>>>> I find the following information in the log file: >>>>>> 2011/01/06 23:36:56 ERROR - jmeter.util.BeanShellInterpreter: Error >>>>>> invoking >>>>>> bsh method: eval Sourced file: inline evaluation of: ``long >>>>>> rt=prev.getTime(); print(rt); Long time1=System.currentTimeMillis() >>>>>> print(t >>>>>> . . . '' : Typed variable declaration : Attempt to resolve method: >>>>>> getTime() >>>>>> on undefined variable or class name: prev >>>>>> 2011/01/06 23:36:56 WARN - jmeter.timers.BeanShellTimer: Problem in >>>>>> BeanShell script org.apache.jorphan.util.JMeterException: Error >>>>>> invoking >>>>>> bsh >>>>>> method: eval Sourced file: inline evaluation of: ``long >>>>>> rt=prev.getTime(); >>>>>> print(rt); Long time1=System.currentTimeMillis() print(t . . . '' : >>>>>> Typed >>>>>> variable declaration : Attempt to resolve method: getTime() on >>>>>> undefined >>>>>> variable or class name: prev >>>>> >>>>> Sorry, it looks like the BeanShellTimer does not have the 'prev' >>>>> variable set up, unlike the BSH PostProcessor >>>>> >>>>> However, you can get it from the context: >>>>> >>>>> prev=ctx.getPreviousResult() >>>>> >>>>> >>>>>> -- >>>>>> View this message in context: >>>>>> http://jmeter.512774.n5.nabble.com/How-to-get-transaction-time-into-a-user-defined-variable-tp3328587p3330602.html >>>>>> Sent from the JMeter - User mailing list archive at Nabble.com. >>>>>> >>>>>> --------------------------------------------------------------------- >>>>>> To unsubscribe, e-mail: [email protected] >>>>>> For additional commands, e-mail: [email protected] >>>>>> >>>>>> >>>>> >>>>> --------------------------------------------------------------------- >>>>> To unsubscribe, e-mail: [email protected] >>>>> For additional commands, e-mail: [email protected] >>>>> >>>>> >>>>> >>>> >>>> Thank you so much! You are my idol!!! >>>> As it's a script variable, I can't watch it in the debug sampler, am I >>>> right? >>> >>> Yes. >>> >>> Script variables are not automatically visible as JMeter variables, >>> but you can use vars.put() to create or update a variable as described >>> in the manual. >>> >>>> I used print to see the value of prev.getTime, and there are 2 lines >>>> of output in the console. Which one will take effect to the BSH Timer? >>>> And I >>>> wonder why there are two different values of the same function. >>> >>> Because the Timer was called twice. >>> >>> Add a print("Timer here") to the script and see. >>> >>>> -- >>>> View this message in context: >>>> http://jmeter.512774.n5.nabble.com/How-to-get-transaction-time-into-a-user-defined-variable-tp3328587p3330699.html >>>> Sent from the JMeter - User mailing list archive at Nabble.com. >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: [email protected] >>>> For additional commands, e-mail: [email protected] >>>> >>>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [email protected] >>> For additional commands, e-mail: [email protected] >>> >>> >>> >> >> I wonder that is there anything like ctx.getPreviousTransactionResult() >> to >> get the previous transaction response time? > > That's what the Javadoc is for. > >> -- >> View this message in context: >> http://jmeter.512774.n5.nabble.com/How-to-get-transaction-time-into-a-user-defined-variable-tp3328587p3331408.html >> Sent from the JMeter - User mailing list archive at Nabble.com. >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > >
It seems that there is no getTime method in TransactionSampler class... But I can get it in the aggregate report listener... -- View this message in context: http://jmeter.512774.n5.nabble.com/How-to-get-transaction-time-into-a-user-defined-variable-tp3328587p3331455.html Sent from the JMeter - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

