title: How to implemet singleThreaded=true in TestNG
body: <p>In TestNG i am trying to undertand the use of <code>singleThreaded=true</code> attibute of <code>@Test</code> Annotation .I already referred <a href="http://testng.org/doc/documentation-main.html" rel="nofollow">http://testng.org/doc/documentation-main.html</a> and 
  <a href="http://beust.com/weblog2/archives/000407.html" rel="nofollow">http://beust.com/weblog2/archives/000407.html</a> but didn't got much help .</p>
  
  <p>My Question : Why do we need to execute method on single thread. Running on multiple thread can save out time.</p>
  
  <p>Note : In the example given at <a href="http://beust.com/weblog2/archives/000407.html" rel="nofollow">http://beust.com/weblog2/archives/000407.html</a></p>
  
  <p>He said :: "the two test methods <code>testf1()</code> and <code>testf2()</code> test the methods <code>A#f1</code> and <code>A#f2</code> respectively, but when you ask TestNG to run these tests in parallel mode, <strong>these two methods will be invoked from different threads, and if they don't properly synchronize with each other, you will most likely end up in a corrupt state.</strong></p>
  
  <p>Can anyone explain with code the above example</p>