You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Erez Naim <er...@theneura.com> on 2015/05/27 12:15:49 UTC

timestamp to a text file

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:

 

 

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

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.t
xt Alias:
C:\Users\QA\git\QA\Tests\Load_Tests\Jmeter_Scripts\Access_Tokens\textLinux.t
xt@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 

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  |
<http://www.linkedin.com/profile/view?id=34323263>
<http://www.theneura.com/vCards/gilad.vcf>
<http://twitter.com/#!/giladmeiri/>   




EL AL 2 Street | Herzliya  
mobile (+972) 50 9 555 686 | fax (408) 689.1366 | skype erez.neura

 


 <http://www.theneura.com/> website  |   <http://www.startupbitz.com/> blog
|   <https://twitter.com/intent/user?screen_name=theneura> twitter  |
<http://goo.gl/maps/ZRkg5> map    

 

 


RE: timestamp to a text file

Posted by Erez Naim <er...@theneura.com>.
Ok I got it solved it thanks for the direction Sebb :) 

-----Original Message-----
From: Erez Naim [mailto:erez@theneura.com] 
Sent: Wednesday, May 27, 2015 4:07 PM
To: 'JMeter Users List'
Subject: RE: timestamp to a text file

Yeah I am using it in order to invoke java in this case what function would you use to calc timestamp? 

-----Original Message-----
From: sebb [mailto:sebbaz@gmail.com]
Sent: Wednesday, May 27, 2015 4:04 PM
To: JMeter Users List
Subject: Re: timestamp to a text file

On 27 May 2015 at 14:00, Erez Naim <er...@theneura.com> 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:sebbaz@gmail.com]
> 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 <er...@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\text
>> L
>> inux.txt
>> Alias:
>> C:\Users\QA\git\QA\Tests\Load_Tests\Jmeter_Scripts\Access_Tokens\text
>> L
>> 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: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>
>>
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org


RE: timestamp to a text file

Posted by Erez Naim <er...@theneura.com>.
Yeah I am using it in order to invoke java in this case what function would you use to calc timestamp? 

-----Original Message-----
From: sebb [mailto:sebbaz@gmail.com] 
Sent: Wednesday, May 27, 2015 4:04 PM
To: JMeter Users List
Subject: Re: timestamp to a text file

On 27 May 2015 at 14:00, Erez Naim <er...@theneura.com> 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:sebbaz@gmail.com]
> 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 <er...@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\text
>> L
>> inux.txt
>> Alias:
>> C:\Users\QA\git\QA\Tests\Load_Tests\Jmeter_Scripts\Access_Tokens\text
>> L
>> 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: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>
>>
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org


Re: timestamp to a text file

Posted by sebb <se...@gmail.com>.
On 27 May 2015 at 14:00, Erez Naim <er...@theneura.com> 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:sebbaz@gmail.com]
> 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 <er...@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\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: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>
>>
>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org


RE: timestamp to a text file

Posted by Erez Naim <er...@theneura.com>.
Thanks I will use Java I totally forgot about it, I used Jmeter function... 

-----Original Message-----
From: sebb [mailto:sebbaz@gmail.com] 
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 <er...@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\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: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>
>
>
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org


Re: timestamp to a text file

Posted by sebb <se...@gmail.com>.
On 27 May 2015 at 11:15, Erez Naim <er...@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>
>
>
>
>
>