jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: timestamp to a text file
Date Wed, 27 May 2015 12:53:20 GMT
On 27 May 2015 at 11:15, Erez Naim <erez@theneura.com> wrote:

> Hello all,
>
>
>
> I would like to add for my successful samplers timestamp which will be
> saved to an outer text file, how can I do it? I have used Jmeter function:
> ${__javaScript(Math.round(new Date().getTime() / 1000))}, but I did not
> find a way how to save it I have added postprocessor beanshell with the
> following code:
>
>
>
>
>
Why do you need to do this? Sample results include the timestamp.


> int temp = ${__javaScript(Math.round(new Date().getTime()))};
>

Does not make sense to call Javascript in a BeanShell test element; just
use standard Java to get the time.


> FileWriter fstream = new
> FileWriter("C:\\path\\to\\my\directory\\timestamp.txt")
>
> BufferedWriter out = new BufferedWriter(fstream);
>
> out.write(temp + "\n");
>
> out.close();
>
>
>
> I am getting the following error message:
>
>
>
> 2015/05/27 13:14:39 INFO  - jmeter.services.FileServer: Stored:
> C:\Users\QA\git\QA\Tests\Load_Tests\Jmeter_Scripts\Access_Tokens\textLinux.txt
> Alias:
> C:\Users\QA\git\QA\Tests\Load_Tests\Jmeter_Scripts\Access_Tokens\textLinux.txt@31914453
>
> 2015/05/27 13:14:44 ERROR - jmeter.util.BeanShellInterpreter: Error
> invoking bsh method: eval Parse error at line 1, column 12 : Error or
> number too big for integer type: 1432721684364
>

Have a look at the variable declaration for the time value ...


> 2015/05/27 13:14:44 WARN  - jmeter.assertions.BeanShellAssertion:
> org.apache.jorphan.util.JMeterException: Error invoking bsh method:
> eval           Parse error at line 1, column 12 : Error or number too big
> for integer type: 1432721684364
>
>
>
> I have tried to use double in order to solve it still it did not save it
> to text file.
>
>
>
> Thanks for any help…
>
>
>
>
>
> Erez Naim  |  QA Lead  |   [image: LinkedIn]
> <http://www.linkedin.com/profile/view?id=34323263>  [image: vCard]
> <http://www.theneura.com/vCards/gilad.vcf>  [image: Twitter]
> <http://twitter.com/#!/giladmeiri/>
>
> [image: cid:image004.png@01D01E1B.5F153500]
>
> EL AL 2 Street | Herzliya
> mobile (+972) 50 9 555 686 | fax (408) 689.1366 | skype erez.neura
>
>
>
> website <http://www.theneura.com/>  |  blog <http://www.startupbitz.com/>
>  |  twitter <https://twitter.com/intent/user?screen_name=theneura>  |  map
> <http://goo.gl/maps/ZRkg5>
>
>
>
>
>

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