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/03/02 09:46:24 UTC

How can I make beanshell to write only once to the console?

Hi,

 

I am writing to an external text file some data , I am trying to write only
once a title to this external file and then write all other info, what I get
right now that for each creation of additional data I write the tittle as
well again and again. how can I make it to write only once. ?

 

Thanks! 

 


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: How can I make beanshell to write only once to the console?

Posted by Dan Zaitoun <da...@jajah.com>.
Erez...:)
How are you

From: Erez Naim [mailto:erez@theneura.com]
Sent: Monday, March 02, 2015 10:46 AM
To: 'JMeter Users List'
Subject: How can I make beanshell to write only once to the console?

Hi,

I am writing to an external text file some data , I am trying to write only once a title to this external file and then write all other info, what I get right now that for each creation of additional data I write the tittle as well again and again... how can I make it to write only once. ?

Thanks!

Erez Naim  |  QA Lead  |   [LinkedIn] <http://www.linkedin.com/profile/view?id=34323263>   [vCard] <http://www.theneura.com/vCards/gilad.vcf>   [Twitter] <http://twitter.com/#!/giladmeiri/>

[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>




Re: How can I make beanshell to write only once to the console?

Posted by SanderW <sa...@performancearchitecten.nl>.
Hi Erez,

Something like this:

File eFile = new File("C:/Erez-test.txt");

if(!eFile.exists()) {
	// Create a file
	f = new FileOutputStream(eFile, true);
	p = new PrintStream(f);
	p.println("Column1\tColumn2\tColumn3");
	p.close();
	f.close();	
}

// Append an already existing file
f = new FileOutputStream(eFile, true);
p = new PrintStream(f);
p.println("Rowitem1\tRowitem2\tRowitem3");
p.close();
f.close();	



--
View this message in context: http://jmeter.512774.n5.nabble.com/How-can-I-make-beanshell-to-write-only-once-to-the-console-tp5721876p5721877.html
Sent from the JMeter - User mailing list archive at Nabble.com.

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