On 27 May 2015 at 14:00, Erez Naim <[email protected]> wrote:
> Thanks I will use Java I totally forgot about it, I used Jmeter function...

Huh?
You are already using Java in BeanShell.
Just use it for everything, including fetching the time.

> -----Original Message-----
> From: sebb [mailto:[email protected]]
> Sent: Wednesday, May 27, 2015 3:53 PM
> To: JMeter Users List
> Subject: Re: timestamp to a text file
>
> On 27 May 2015 at 11:15, Erez Naim <[email protected]> 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\textL
>> inux.txt
>> Alias:
>> C:\Users\QA\git\QA\Tests\Load_Tests\Jmeter_Scripts\Access_Tokens\textL
>> inux.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:[email protected]]
>>
>> 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>
>>
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> 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]

Reply via email to