<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>NULL.in</title>
	<atom:link href="http://www.nalinmakar.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nalinmakar.com</link>
	<description>Nalin's Labyrinth</description>
	<lastBuildDate>Tue, 31 Aug 2010 03:58:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Whats with digg lately?</title>
		<link>http://www.nalinmakar.com/2010/08/30/whats-with-digg-lately/</link>
		<comments>http://www.nalinmakar.com/2010/08/30/whats-with-digg-lately/#comments</comments>
		<pubDate>Tue, 31 Aug 2010 03:58:58 +0000</pubDate>
		<dc:creator>Nalin</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://www.nalinmakar.com/?p=732</guid>
		<description><![CDATA[Of the 16 top stories for the last 24hrs on digg.com, 1 is a sponsored link and 14 others are other stories at reddit.com! I have noticed this for the last couple of days. Not to mention the frequent downtimes and the not so great interface. Random PostsNalin at Tech MuseumMulholland DriveQuick Reference CardsJarheadMy recent [...]]]></description>
			<content:encoded><![CDATA[<p>Of the 16 top stories for the <a title="Top stories for last 24hrs on digg.com" href="http://digg.com/news/24hr">last 24hrs on digg.com</a>, 1 is a sponsored link and <strong>14</strong> others are other stories at <a title="Reddit.com" href="http://reddit.com">reddit.com</a>! I have noticed this for the last couple of days. Not to mention the frequent downtimes and the not so great interface.</p>
<p><a href="http://www.nalinmakar.com/blog/wp-content/uploads/2010/08/Digg-Top-in-24-Hours.jpg" rel="lightbox"><img class="aligncenter size-large wp-image-743" title="Digg-Top-in-24-Hours" src="http://www.nalinmakar.com/blog/wp-content/uploads/2010/08/Digg-Top-in-24-Hours-668x1024.jpg" alt="" width="668" height="1024" /></a></p>
<h3  class="related_post_title">Random Posts</h3><ul class="related_post"><li><a href="http://www.nalinmakar.com/2010/08/29/hemingwayex-v1-8-released/" title="HemingwayEx v1.8 released">HemingwayEx v1.8 released</a></li><li><a href="http://www.nalinmakar.com/2006/01/01/happy-new-year/" title="Happy New Year">Happy New Year</a></li><li><a href="http://www.nalinmakar.com/2005/11/06/murderball/" title="Murderball">Murderball</a></li><li><a href="http://www.nalinmakar.com/2007/01/31/bill-gates-on-the-daily-show/" title="Bill Gates on The Daily Show">Bill Gates on The Daily Show</a></li><li><a href="http://www.nalinmakar.com/2006/04/06/some-game/" title="Some Game">Some Game</a></li><li><a href="http://www.nalinmakar.com/2005/10/02/the-big-white/" title="The Big White">The Big White</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.nalinmakar.com/2010/08/30/whats-with-digg-lately/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HemingwayEx v1.8 released</title>
		<link>http://www.nalinmakar.com/2010/08/29/hemingwayex-v1-8-released/</link>
		<comments>http://www.nalinmakar.com/2010/08/29/hemingwayex-v1-8-released/#comments</comments>
		<pubDate>Sun, 29 Aug 2010 19:59:21 +0000</pubDate>
		<dc:creator>Nalin</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[hemingwayex]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://www.nalinmakar.com/?p=728</guid>
		<description><![CDATA[I played around a bit with WP 3.0 Menus and was able to incorporate it into HemingwayEx. Also, with this theme, users can decide to have a single column homepage instead of have the two columns. Setting up WP Menus was quite straightforward actually, based on information in Nicholas&#8217;s article. Then there was some work [...]]]></description>
			<content:encoded><![CDATA[<p>I played around a bit with WP 3.0 Menus and was able to incorporate it into HemingwayEx. Also, with this theme, users can decide to have a single column homepage instead of have the two columns.</p>
<p>Setting up WP Menus was quite straightforward actually, based on information in <a href="http://www.nkuttler.de/2010/06/08/wp_nav_menu-wordpress-3-0/">Nicholas&#8217;s article</a>. Then there was some work needed to show drop down menus and for that I chose to use the <a href="http://users.tpg.com.au/j_birch/plugins/superfish/">Superfish JQuery Plugin</a>. The site&#8217;s got everything you need to get the Superfish menus working. I just needed to make a few tweaks to the arrow images to change the color from white to black and had to fix the CSS.</p>
<p>One thing that caused me considerable amount of headache was invoking the superfish js using jQuery when document loads. Because other parts of the theme were also using jQuery and other JavaScripts, I had to use the <a href="http://docs.jquery.com/Using_jQuery_with_Other_Libraries">JQuery NoConfict mode</a>. I had to change the following:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script  type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span> 
    $<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> 
        $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;ul.sf-menu&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">superfish</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>to</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script  type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>  
    $j <span style="color: #339933;">=</span> jQuery.<span style="color: #660066;">noConflict</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    $j<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
        $j<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'ul.sf-menu'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">superfish</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
    <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>And then everything worked perfectly. Hope you enjoy this release. </p>
<p>I have started hosting <a href="http://github.com/nullin/hemingwayex">HemingwayEx code and downloads on Github</a> now. <a href="http://github.com/downloads/nullin/hemingwayex/hemingwayEx_1.8.zip">v1.8</a> is available for download right now.</p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.nalinmakar.com/2010/07/19/hemingwayex-v1-7-released/" title="HemingwayEx v1.7 released">HemingwayEx v1.7 released</a></li><li><a href="http://www.nalinmakar.com/2008/09/02/hemingwayex-15-final/" title="HemingwayEx 1.5 Final">HemingwayEx 1.5 Final</a></li><li><a href="http://www.nalinmakar.com/2008/04/29/hemingwayex-11-is-finally-here/" title="Hemingwayex 1.1 is finally here">Hemingwayex 1.1 is finally here</a></li><li><a href="http://www.nalinmakar.com/2007/12/02/hemingwayex-11-on-its-way/" title="HemingwayEx 1.1 on it&#8217;s way">HemingwayEx 1.1 on it&#8217;s way</a></li><li><a href="http://www.nalinmakar.com/2007/07/15/say-hello-to-hemingwayex-10/" title="Say Hello to HemingwayEx 1.0">Say Hello to HemingwayEx 1.0</a></li><li><a href="http://www.nalinmakar.com/hemingwayex/" title="HemingwayEx">HemingwayEx</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.nalinmakar.com/2010/08/29/hemingwayex-v1-8-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Logging tests to separate files</title>
		<link>http://www.nalinmakar.com/2010/07/28/logging-tests-to-separate-files/</link>
		<comments>http://www.nalinmakar.com/2010/07/28/logging-tests-to-separate-files/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 04:07:34 +0000</pubDate>
		<dc:creator>Nalin</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[logback]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[testng]]></category>

		<guid isPermaLink="false">http://www.nalinmakar.com/?p=655</guid>
		<description><![CDATA[We have been using TestNG to run our tests for a while now. When we initially started, our code was written using Log4J and we were able to configure it to log all the tests to a single file. This made the logs very unwieldy and looking for issues very difficult. Looking at 100+ MB [...]]]></description>
			<content:encoded><![CDATA[<p>We have been using TestNG to run our tests for a while now. When we initially started, our code was written using Log4J and we were able to configure it to log all the tests to a single file. This made the logs very unwieldy and looking for issues very difficult. Looking at 100+ MB of logs isn&#8217;t an easy task. Changing this to rolling files only made the matters worse. So, I started looking for ways to log each test case into a separate file (meaning a test named foo, would be logged to foo.log).</p>
<p>My first attempt was to do this using log4j itself. Log4J doesn&#8217;t provide an easy way of doing this. It&#8217;s possible if you follow certain conventions in declaring your loggers and how you use MDC, but I wasn&#8217;t able to get it working with all my code. On looking a bit further, I found <a href="http://logback.qos.ch/">Logback</a>. And <a href="http://logback.qos.ch/manual/appenders.html#SiftingAppender">SiftingAppender</a> in Logback is just what I needed.</p>
<p>So, using <a href="http://www.slf4j.org/">slf4j</a>, <a href="http://logback.qos.ch/">logback</a>, <a href="http://logback.qos.ch/manual/mdc.html">MDC</a> and a few simple coding conventions, I was able to get per test log files working. Here&#8217;s what you need to do:</p>
<ol>
<li>Start using SLF4J for your logging. If you are using Log4J, <a href="http://www.slf4j.org/migrator.html">moving from L0g4J to SLF4J</a> is pretty simple</li>
<li>Write functions to set MDC at start of a test and unset it at the end of a test</li>
<li>Update the test cases, such that the MDC set/unset functions are invoked</li>
<li>Configure logback.xml to use the SiftingAppender</li>
</ol>
<p>I&#8217;ll expand a bit more on the above.</p>
<h2>Using SLF4J</h2>
<p>Starting to use SLF4J or moving to SLF4J from other logging frameworks is pretty straightforward. I didn&#8217;t bother using the java application at <a href="http://www.slf4j.org/migrator.html">http://www.slf4j.org/migrator.html</a> and found it much easier to just to regex to do the job. There were some places where <tt>log.xxx(object)</tt> had to be changed to <tt>log.xxx(object.toString())</tt> but that wasn&#8217;t a whole lot of pain.</p>
<h2>Code to set/unset MDC</h2>
<p>Logback&#8217;s documentation on MDC is very extensive and explains the concept quite clearly. Essentially using MDC would allow us to share a key/value across a thread hierarchy. Using MDC is as simple as putting a key/value into a Map. This value will be accessible anytime in the thread and any children of that thread. At the beginning of the test, we&#8217;ll put <tt>&lt;"testname", $test_case_name&gt;</tt> as the key/value into the map. At the end of the test, we&#8217;ll remove this key. This MDC value would be used by the sifting appender to create logs at runtime.  I wrote a simple class to encapsulate this functionality:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.nm.examples</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.slf4j.Logger</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.slf4j.LoggerFactory</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.slf4j.MDC</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
 * Class to handle setting/removing MDC on per test case basis. This helps
 * us log each test case into it's own log file. Please see
 * {@link http://logback.qos.ch/manual/appenders.html#SiftingAppender}
 * and {@link http://logback.qos.ch/manual/mdc.html}
 * @author nullin
 */</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> TestLogHelper
<span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> Logger log <span style="color: #339933;">=</span> LoggerFactory.<span style="color: #006633;">getLogger</span><span style="color: #009900;">&#40;</span>TestLogHelper.<span style="color: #000000; font-weight: bold;">class</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #003399;">String</span> TEST_NAME <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;testname&quot;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #008000; font-style: italic; font-weight: bold;">/**
   * Adds the test name to MDC so that sift appender can use it and log the new
   * log events to a different file
   * @param name name of the new log file
   * @throws Exception
   */</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> startTestLogging<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> name<span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span> <span style="color: #009900;">&#123;</span>
    MDC.<span style="color: #006633;">put</span><span style="color: #009900;">&#40;</span>TEST_NAME, name<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #008000; font-style: italic; font-weight: bold;">/**
   * Removes the key (log file name) from MDC
   * @return name of the log file, if one existed in MDC
   */</span>
  <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #003399;">String</span> stopTestLogging<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003399;">String</span> name <span style="color: #339933;">=</span> MDC.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span>TEST_NAME<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    MDC.<span style="color: #006633;">remove</span><span style="color: #009900;">&#40;</span>TEST_NAME<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">return</span> name<span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h2>Update test cases</h2>
<p>Now, you just need to make sure that you invoke <tt>TestLogHelper.startTestLogging(String testname)</tt> as early as possible during the test execution. Eventually, by the end of the test you should invoke <tt>TestLogHelper.stopTestLogging()</tt> to ensure that no extra logs get logged into this log file.</p>
<p>As we are using TestNG, for us it was a very simple matter of creating a method annotated @BeforeClass or @BeforeMethod as per requirements and put this code in there. For example, I use the following two methods in the base class for all our tests:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;">   @BeforeClass
   <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> testSetUp<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #666666; font-style: italic;">//start logging to test specific log file</span>
      TestLogHelper.<span style="color: #006633;">startTestLogging</span><span style="color: #009900;">&#40;</span>getTestId<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #666666; font-style: italic;">//</span>
      <span style="color: #666666; font-style: italic;">//Do some setup specific stuff here</span>
      <span style="color: #666666; font-style: italic;">//</span>
   <span style="color: #009900;">&#125;</span>
&nbsp;
   @AfterClass
   <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> testCleanUp<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">throws</span> <span style="color: #003399;">Exception</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
         <span style="color: #666666; font-style: italic;">//</span>
         <span style="color: #666666; font-style: italic;">//Do some cleanup specific stuff here</span>
         <span style="color: #666666; font-style: italic;">//</span>
      <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">finally</span> <span style="color: #009900;">&#123;</span>
         <span style="color: #666666; font-style: italic;">//stop test logging to test specific file</span>
         TestLogHelper.<span style="color: #006633;">stopTestLogging</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
      <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
&nbsp;
   <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getTestId<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>testId <span style="color: #339933;">==</span> <span style="color: #000066; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">?</span> <span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">getClass</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getName</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> testId<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span></pre></div></div>

<h2>Configure logback.xml with SiftingAppender</h2>
<p>The last part is to configure the logback.xml to use a SiftingAppender. You can look at the <a href="http://logback.qos.ch/manual/appenders.html#SiftingAppender">documentation for SiftingAppender</a> to see the different examples. Following is a snippet of the configuration that I am using:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;appender</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;RootSiftAppender&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;ch.qos.logback.classic.sift.SiftingAppender&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;discriminator<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Key<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;strong<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>testname<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/strong<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/Key<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;DefaultValue<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;strong<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>testrun<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/strong<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/DefaultValue<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/discriminator<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;sift<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;appender</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;FILE-${testname}&quot;</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;ch.qos.logback.core.rolling.RollingFileAppender&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;File<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${testname}.log<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/File<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;rollingPolicy</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;ch.qos.logback.core.rolling.FixedWindowRollingPolicy&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
               <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;FileNamePattern<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;strong<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>${testname}.%i.log<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/strong<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/FileNamePattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
               <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;MinIndex<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/MinIndex<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
               <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;MaxIndex<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>100<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/MaxIndex<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/rollingPolicy<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;triggeringPolicy</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
               <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;MaxFileSize<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>5MB<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/MaxFileSize<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/triggeringPolicy<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;layout</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;ch.qos.logback.classic.PatternLayout&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
               <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>%d{ISO8601} %-5level %C{1} [%M:%L] [%thread] - %msg%n<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Pattern<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/layout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/appender<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/sift<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/appender<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>This configuration says that the test cases would specify the MDC value using a key &#8220;testname&#8221; and if logback finds no such key, it&#8217;ll just log the statements into <tt>testrun.log</tt>.</p>
<p>And that&#8217;s it. You should be good to go.</p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.nalinmakar.com/2010/03/26/hudson-ci-for-testing/" title="Hudson CI for Testing">Hudson CI for Testing</a></li><li><a href="http://www.nalinmakar.com/2009/12/23/running-single-test-or-class-using-testng-and-ant/" title="Running single test or class using TestNG and Ant">Running single test or class using TestNG and Ant</a></li><li><a href="http://www.nalinmakar.com/2008/12/13/connect-to-ms-sql-server-using-jdbc/" title="Connect to MS SQL Server using JDBC">Connect to MS SQL Server using JDBC</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.nalinmakar.com/2010/07/28/logging-tests-to-separate-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HemingwayEx v1.7 released</title>
		<link>http://www.nalinmakar.com/2010/07/19/hemingwayex-v1-7-released/</link>
		<comments>http://www.nalinmakar.com/2010/07/19/hemingwayex-v1-7-released/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 05:37:05 +0000</pubDate>
		<dc:creator>Nalin</dc:creator>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[hemingwayex]]></category>
		<category><![CDATA[theme]]></category>

		<guid isPermaLink="false">http://www.nalinmakar.com/?p=712</guid>
		<description><![CDATA[I finally found some time yesterday to fix a bug and made HemingwayEx compatible with WP3.0. It&#8217;s been a long time since the last official release. A lot of work has gone into this theme between the last few revisions and most of it was done by db0. He spent a great amount of time [...]]]></description>
			<content:encoded><![CDATA[<p>I finally found some time yesterday to fix a bug and made HemingwayEx compatible with WP3.0. It&#8217;s been a long time since the last official release. A lot of work has gone into this theme between the last few revisions and most of it was done by <a href="http://github.com/db0">db0</a>. He spent a great amount of time enhancing the theme and adding support for many plugins.</p>
<p>I have moved the source of <a href="http://github.com/nullin/hemingwayex">HemingwayEx</a> to Github. It&#8217;s a great place to code socially because it makes it very easy for anyone to create a patch and submit it for addition to the main project.</p>
<p>Anyways, you can get the <a href="http://github.com/nullin/hemingwayex/downloads">latest version of HemingwayEx at github</a>.</p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.nalinmakar.com/2010/08/29/hemingwayex-v1-8-released/" title="HemingwayEx v1.8 released">HemingwayEx v1.8 released</a></li><li><a href="http://www.nalinmakar.com/2008/09/02/hemingwayex-15-final/" title="HemingwayEx 1.5 Final">HemingwayEx 1.5 Final</a></li><li><a href="http://www.nalinmakar.com/2008/04/29/hemingwayex-11-is-finally-here/" title="Hemingwayex 1.1 is finally here">Hemingwayex 1.1 is finally here</a></li><li><a href="http://www.nalinmakar.com/2007/12/02/hemingwayex-11-on-its-way/" title="HemingwayEx 1.1 on it&#8217;s way">HemingwayEx 1.1 on it&#8217;s way</a></li><li><a href="http://www.nalinmakar.com/2007/07/15/say-hello-to-hemingwayex-10/" title="Say Hello to HemingwayEx 1.0">Say Hello to HemingwayEx 1.0</a></li><li><a href="http://www.nalinmakar.com/hemingwayex/" title="HemingwayEx">HemingwayEx</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.nalinmakar.com/2010/07/19/hemingwayex-v1-7-released/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Hudson CI for Testing</title>
		<link>http://www.nalinmakar.com/2010/03/26/hudson-ci-for-testing/</link>
		<comments>http://www.nalinmakar.com/2010/03/26/hudson-ci-for-testing/#comments</comments>
		<pubDate>Sat, 27 Mar 2010 06:17:44 +0000</pubDate>
		<dc:creator>Nalin</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[Linux/Unix]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[ci]]></category>
		<category><![CDATA[hudson]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[qa]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.nalinmakar.com/?p=696</guid>
		<description><![CDATA[We are heavily using Hudson for testing a product we are working on. Other than maintenance and some instability issues, it&#8217;s been a great experience working with Hudson. We started out with just a single machine running Hudson server and then soon moved to a master-slave configuration where we have setup one master connected to [...]]]></description>
			<content:encoded><![CDATA[<p>We are heavily using <a title="Hudson CI" href="http://hudson-ci.org/">Hudson</a> for <em><strong>testing</strong></em> a product we are working on. Other than maintenance and some instability issues, it&#8217;s been a great experience working with Hudson. We started out with just a single machine running Hudson server and then soon moved to a master-slave configuration where we have setup one master connected to four slaves. We are currently running about 10-15 jobs on this setup at one point or another during the day and use it to run pre-checkins (well in a way *post*-checkins), BATs and regression runs.</p>
<p>Here are a couple of screenshots that I took  when we were just getting started and were stabilizing Hudson and the product.</p>

<a href='http://www.nalinmakar.com/2010/03/26/hudson-ci-for-testing/hudson_all_jobs/' title='hudson_all_jobs'><img width="150" height="150" src="http://www.nalinmakar.com/blog/wp-content/uploads/2010/03/hudson_all_jobs-150x150.png" class="attachment-thumbnail" alt="hudson_all_jobs" title="hudson_all_jobs" /></a>
<a href='http://www.nalinmakar.com/2010/03/26/hudson-ci-for-testing/hudson_main_branch/' title='hudson_main_branch'><img width="150" height="150" src="http://www.nalinmakar.com/blog/wp-content/uploads/2010/03/hudson_main_branch-150x150.png" class="attachment-thumbnail" alt="hudson_main_branch" title="hudson_main_branch" /></a>

<p>We have the following kinds of jobs running on this system:</p>
<ol>
<li><em>Pre-checkins</em>: We provide development team with a set of tests that they are supposed to run before they commit any code. To ensure that the development team was doing this, we have a job that runs pre-checkins tests on every commit. This helps us ensure that things remain green though out the day and we come to know of failures asap.</li>
<li><em>BATs</em>: Basic Acceptance Tests as another category of tests that help us ascertain the daily quality of builds. Before the QA picks up a build for testing, we run the BATs against the daily official build and make sure that all tests pass.</li>
<li><em>Regression runs</em>: We also use hudson to run regression tests. At time of taking this screenshots, we had only about a 1000 tests and hence had a single job which would run all the tests and would take about 6-7 hours to complete. Now, we have split up that job into multiple jobs by <a title="Splitting a big job into multiple=" href="http://wiki.hudson-ci.org/display/HUDSON/Splitting+a+big+job+into+smaller+jobs">using multiple build stages</a> that Hudson supports. I will talk more about this in a later post.</li>
<li><em>Helper jobs</em>: We have <a href="http://wiki.hudson-ci.org/display/HUDSON/Parameterized+Build">parameterized jobs</a> setup that help any one (dev or QA) to start any kind of test run against an official or sandbox build.</li>
<li><em>CI jobs</em>: This is how Hudson was originally intended to be used. For each branch that we work on, we poll the SCM every 5 minutes to check for checkins and build the dev and QA code. This helps us ensure that the code any checkin hasn&#8217;t broken the QA build and that users have access to the latest artifacts/distributions at all times.</li>
</ol>
<p>For the project, we had invested time into providing infrastructure to pick up official/sandbox builds and then using these builds to setup environment, configure tests and then execute the tests. We just had to put in some more time to change or add features to make it all work easier with Hudson. Now, instead of letting everyone fend for themselves when it comes to setting up environments for testing and then reporting the results, we use Hudson to automate that process to a very large extent and make these tasks more manageable and the product quality more visible.</p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.nalinmakar.com/2010/07/28/logging-tests-to-separate-files/" title="Logging tests to separate files">Logging tests to separate files</a></li><li><a href="http://www.nalinmakar.com/2008/12/13/connect-to-ms-sql-server-using-jdbc/" title="Connect to MS SQL Server using JDBC">Connect to MS SQL Server using JDBC</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.nalinmakar.com/2010/03/26/hudson-ci-for-testing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My Toyota Camry&#8217;s mileage</title>
		<link>http://www.nalinmakar.com/2010/03/23/my-toyota-camrys-mileage/</link>
		<comments>http://www.nalinmakar.com/2010/03/23/my-toyota-camrys-mileage/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 06:16:55 +0000</pubDate>
		<dc:creator>Nalin</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[camry]]></category>
		<category><![CDATA[mileage]]></category>
		<category><![CDATA[toyota]]></category>

		<guid isPermaLink="false">http://www.nalinmakar.com/?p=677</guid>
		<description><![CDATA[Tracked the mileage of my car for about 3 years. Most of my driving was city driving and about 15-25 miles a day. Took a few road trips as well, longest being to Las Vegas, Grand Canyon and back to bay area. Some of the numbers are missing and some are skewed because of getting [...]]]></description>
			<content:encoded><![CDATA[<p>Tracked the mileage of my car for about 3 years. Most of my driving was city driving and about 15-25 miles a day. Took a few road trips as well, longest being to Las Vegas, Grand Canyon and back to bay area. Some of the numbers are missing and some are skewed because of getting different amounts of gas filled but the average mileage does come out to about 20-22 mpg.</p>
<table style="width: 350px; text-align: left; margin-left: auto; margin-right: auto; height: 1676px;" border="1" cellspacing="0" cellpadding="5">
<tbody>
<tr>
<th style="background-color: #cccccc;">Date</th>
<th style="background-color: #cccccc;">Miles</th>
<th style="background-color: #cccccc;">Gallons</th>
<th style="background-color: #cccccc;">Amount</th>
<th style="background-color: #cccccc;">Price</th>
<th style="background-color: #cccccc;">Mileage</th>
</tr>
<tr>
<td>10/30/06</td>
<td>355</td>
<td>15.092</td>
<td>$35.00</td>
<td>$2.319</td>
<td>19.613</td>
</tr>
<tr>
<td>11/13/06</td>
<td>651</td>
<td>14.332</td>
<td>$34.10</td>
<td>$2.379</td>
<td>20.514</td>
</tr>
<tr>
<td>11/23/06</td>
<td>945</td>
<td>13.942</td>
<td>$34.56</td>
<td>$2.479</td>
<td>25.463</td>
</tr>
<tr>
<td>11/29/06</td>
<td>1,300</td>
<td>15.001</td>
<td>$36.14</td>
<td>$2.409</td>
<td>21.465</td>
</tr>
<tr>
<td>12/19/06</td>
<td>1,622</td>
<td>15.480</td>
<td>$41.01</td>
<td>$2.649</td>
<td>20.672</td>
</tr>
<tr>
<td>01/09/07</td>
<td>1,942</td>
<td>14.368</td>
<td>$38.35</td>
<td>$2.669</td>
<td>21.297</td>
</tr>
<tr>
<td>01/27/07</td>
<td>2,248</td>
<td>14.732</td>
<td>$37.55</td>
<td>$2.549</td>
<td>22.061</td>
</tr>
<tr>
<td>02/14/07</td>
<td>2,573</td>
<td>15.288</td>
<td>$42.79</td>
<td>$2.799</td>
<td>22.109</td>
</tr>
<tr>
<td>03/02/07</td>
<td>2,911</td>
<td>16.074</td>
<td>$48.05</td>
<td>$2.989</td>
<td>18.290</td>
</tr>
<tr>
<td>03/10/07</td>
<td>3,205</td>
<td>12.090</td>
<td>$38.68</td>
<td>$3.199</td>
<td>28.040</td>
</tr>
<tr>
<td>03/24/07</td>
<td>3,544</td>
<td>15.365</td>
<td>$49.15</td>
<td>$3.199</td>
<td>21.282</td>
</tr>
<tr>
<td>04/12/07</td>
<td>3,871</td>
<td>15.209</td>
<td>$50.78</td>
<td>$3.339</td>
<td>24.328</td>
</tr>
<tr>
<td>04/20/07</td>
<td>4,241</td>
<td>15.647</td>
<td>$52.71</td>
<td>$3.369</td>
<td>21.474</td>
</tr>
<tr>
<td>05/13/07</td>
<td>4,577</td>
<td>16.001</td>
<td>$55.51</td>
<td>$3.469</td>
<td>16.061</td>
</tr>
<tr>
<td>05/25/07</td>
<td>4,834</td>
<td>10.738</td>
<td>$36.93</td>
<td>$3.439</td>
<td></td>
</tr>
<tr>
<td>05/26/07</td>
<td>5,229</td>
<td>14.077</td>
<td>$47.85</td>
<td>$3.399</td>
<td>22.661</td>
</tr>
<tr>
<td>05/27/07</td>
<td>5,548</td>
<td>7.023</td>
<td>$25.14</td>
<td>$3.580</td>
<td></td>
</tr>
<tr>
<td>05/31/07</td>
<td>5,758</td>
<td>14.522</td>
<td>$49.65</td>
<td>$3.419</td>
<td>21.898</td>
</tr>
<tr>
<td>06/22/07</td>
<td>6,076</td>
<td>15.975</td>
<td>$52.70</td>
<td>$3.299</td>
<td>22.160</td>
</tr>
<tr>
<td>07/05/07</td>
<td>6,430</td>
<td>15.987</td>
<td>$50.18</td>
<td>$3.139</td>
<td>21.517</td>
</tr>
<tr>
<td>07/14/07</td>
<td>6,774</td>
<td>14.929</td>
<td>$47.61</td>
<td>$3.189</td>
<td>22.373</td>
</tr>
<tr>
<td>08/07/07</td>
<td>7,108</td>
<td>15.436</td>
<td>$46.91</td>
<td>$3.039</td>
<td>21.379</td>
</tr>
<tr>
<td>08/25/07</td>
<td>7,438</td>
<td>14.856</td>
<td>$42.18</td>
<td>$2.839</td>
<td>22.281</td>
</tr>
<tr>
<td>09/07/07</td>
<td>7,769</td>
<td>15.579</td>
<td>$45.01</td>
<td>$2.889</td>
<td>24.584</td>
</tr>
<tr>
<td>09/24/07</td>
<td>8,152</td>
<td>16.550</td>
<td>$49.47</td>
<td>$2.989</td>
<td>23.142</td>
</tr>
<tr>
<td>10/12/07</td>
<td>8,535</td>
<td>15.955</td>
<td>$49.76</td>
<td>$3.119</td>
<td>21.811</td>
</tr>
<tr>
<td>10/26/07</td>
<td>8,883</td>
<td>15.678</td>
<td>$50.47</td>
<td>$3.219</td>
<td>23.536</td>
</tr>
<tr>
<td>11/11/07</td>
<td>9,252</td>
<td>16.274</td>
<td>$55.64</td>
<td>$3.419</td>
<td>10.630</td>
</tr>
<tr>
<td>11/18/07</td>
<td>9,425</td>
<td>7.864</td>
<td>$27.36</td>
<td>$3.479</td>
<td>50.483</td>
</tr>
<tr>
<td>11/26/07</td>
<td>9,822</td>
<td>15.581</td>
<td>$53.89</td>
<td>$3.459</td>
<td>20.538</td>
</tr>
<tr>
<td>01/06/08</td>
<td>10,142</td>
<td>14.811</td>
<td>$50.34</td>
<td>$3.399</td>
<td>23.496</td>
</tr>
<tr>
<td>01/18/08</td>
<td>10,490</td>
<td>14.921</td>
<td>$49.08</td>
<td>$3.289</td>
<td>21.781</td>
</tr>
<tr>
<td>02/01/08</td>
<td>10,815</td>
<td>15.337</td>
<td>$48.45</td>
<td>$3.159</td>
<td>23.342</td>
</tr>
<tr>
<td>02/18/08</td>
<td>11,173</td>
<td>15.779</td>
<td>$51.74</td>
<td>$3.279</td>
<td>21.801</td>
</tr>
<tr>
<td>03/03/08</td>
<td>11,517</td>
<td>15.932</td>
<td>$56.38</td>
<td>$3.539</td>
<td>22.219</td>
</tr>
<tr>
<td>03/13/08</td>
<td>11,871</td>
<td>15.953</td>
<td>$58.05</td>
<td>$3.639</td>
<td>22.692</td>
</tr>
<tr>
<td>03/29/08</td>
<td>12,233</td>
<td>5.497</td>
<td>$20.00</td>
<td>$3.638</td>
<td>29.471</td>
</tr>
<tr>
<td>04/01/08</td>
<td>12,395</td>
<td>15.965</td>
<td>$58.74</td>
<td>$3.679</td>
<td>22.863</td>
</tr>
<tr>
<td>04/19/08</td>
<td>12,760</td>
<td>15.558</td>
<td>$60.04</td>
<td>$3.859</td>
<td>24.296</td>
</tr>
<tr>
<td>05/04/08</td>
<td>13,138</td>
<td>15.697</td>
<td>$61.67</td>
<td>$3.929</td>
<td></td>
</tr>
<tr>
<td>05/22/08</td>
<td></td>
<td>15.948</td>
<td>$65.06</td>
<td>$4.080</td>
<td></td>
</tr>
<tr>
<td>06/08/08</td>
<td>13,810</td>
<td>10.372</td>
<td>$45.00</td>
<td>$4.339</td>
<td>35.866</td>
</tr>
<tr>
<td>06/21/08</td>
<td>14,182</td>
<td>16.487</td>
<td>$75.00</td>
<td>$4.549</td>
<td>22.442</td>
</tr>
<tr>
<td>07/07/08</td>
<td>14,552</td>
<td>15.003</td>
<td>$67.95</td>
<td>$4.529</td>
<td>26.728</td>
</tr>
<tr>
<td>07/26/08</td>
<td>14,953</td>
<td>15.224</td>
<td>$66.77</td>
<td>$4.386</td>
<td>23.975</td>
</tr>
<tr>
<td>08/15/08</td>
<td>15,318</td>
<td>15.094</td>
<td>$62.78</td>
<td>$4.159</td>
<td>23.122</td>
</tr>
<tr>
<td>08/27/08</td>
<td>15,667</td>
<td>14.551</td>
<td>$57.90</td>
<td>$3.979</td>
<td>25.222</td>
</tr>
<tr>
<td>09/15/08</td>
<td>16,034</td>
<td>15.227</td>
<td>$59.07</td>
<td>$3.879</td>
<td>23.248</td>
</tr>
<tr>
<td>10/01/08</td>
<td>16,388</td>
<td>14.544</td>
<td>$54.38</td>
<td>$3.739</td>
<td>24.684</td>
</tr>
<tr>
<td>10/17/08</td>
<td>16,747</td>
<td>15.093</td>
<td>$52.21</td>
<td>$3.459</td>
<td>27.430</td>
</tr>
<tr>
<td>10/29/08</td>
<td>17,161</td>
<td>7.671</td>
<td>$25.00</td>
<td>$3.259</td>
<td>27.115</td>
</tr>
<tr>
<td>11/03/08</td>
<td>17,369</td>
<td>16.543</td>
<td>$48.95</td>
<td>$2.959</td>
<td>21.943</td>
</tr>
<tr>
<td>11/23/08</td>
<td>17,732</td>
<td>15.059</td>
<td>$32.51</td>
<td>$2.159</td>
<td>24.172</td>
</tr>
<tr>
<td>01/12/09</td>
<td>18,096</td>
<td>15.338</td>
<td>$31.22</td>
<td>$2.035</td>
<td></td>
</tr>
<tr>
<td>01/25/09</td>
<td></td>
<td>16.237</td>
<td>$34.08</td>
<td>$2.099</td>
<td></td>
</tr>
<tr>
<td>02/13/09</td>
<td></td>
<td>14.644</td>
<td>$33.08</td>
<td>$2.259</td>
<td></td>
</tr>
<tr>
<td>03/03/09</td>
<td></td>
<td>12.829</td>
<td>$28.47</td>
<td>$2.219</td>
<td></td>
</tr>
<tr>
<td>03/21/09</td>
<td></td>
<td>14.982</td>
<td>$32.05</td>
<td>$2.139</td>
<td></td>
</tr>
<tr>
<td>04/13/09</td>
<td>19,889</td>
<td>15.671</td>
<td>$36.03</td>
<td>$2.299</td>
<td>24.759</td>
</tr>
<tr>
<td>05/07/09</td>
<td>20,277</td>
<td>14.845</td>
<td>$36.06</td>
<td>$2.429</td>
<td>19.333</td>
</tr>
<tr>
<td>05/22/09</td>
<td>20,564</td>
<td>11.333</td>
<td>$29.91</td>
<td>$2.639</td>
<td>18.265</td>
</tr>
<tr>
<td>05/22/09</td>
<td>20,771</td>
<td>6.846</td>
<td>$18.20</td>
<td>$2.658</td>
<td>51.855</td>
</tr>
<tr>
<td>05/23/09</td>
<td>21,126</td>
<td>12.561</td>
<td>$30.64</td>
<td>$2.439</td>
<td>14.887</td>
</tr>
<tr>
<td>05/24/09</td>
<td>21,313</td>
<td>6.978</td>
<td>$18.83</td>
<td>$2.698</td>
<td>61.479</td>
</tr>
<tr>
<td>05/25/09</td>
<td>21,742</td>
<td>14.330</td>
<td>$38.82</td>
<td>$2.709</td>
<td>24.703</td>
</tr>
<tr>
<td>05/25/09</td>
<td>22,096</td>
<td>12.850</td>
<td>$35.71</td>
<td>$2.779</td>
<td>32.840</td>
</tr>
<tr>
<td>06/11/09</td>
<td>22,518</td>
<td>15.301</td>
<td>$46.19</td>
<td>$3.019</td>
<td></td>
</tr>
<tr>
<td>07/04/09</td>
<td></td>
<td>14.119</td>
<td>$42.34</td>
<td>$2.999</td>
<td></td>
</tr>
<tr>
<td>07/20/09</td>
<td>23,303</td>
<td>14.826</td>
<td>$42.09</td>
<td>$2.839</td>
<td></td>
</tr>
<tr>
<td>08/16/09</td>
<td></td>
<td>15.099</td>
<td>$46.79</td>
<td>$3.099</td>
<td></td>
</tr>
<tr>
<td>09/24/09</td>
<td></td>
<td>15.670</td>
<td>$50.13</td>
<td>$3.199</td>
<td></td>
</tr>
<tr>
<td>10/11/09</td>
<td></td>
<td>14.757</td>
<td>$46.62</td>
<td>$3.159</td>
<td></td>
</tr>
<tr>
<td>11/12/09</td>
<td></td>
<td>14.591</td>
<td>$43.76</td>
<td>$2.999</td>
<td></td>
</tr>
<tr>
<td>12/10/09</td>
<td></td>
<td>15.355</td>
<td>$44.82</td>
<td>$2.919</td>
<td></td>
</tr>
<tr>
<td>02/28/10</td>
<td></td>
<td>14.865</td>
<td>$44.58</td>
<td>$2.999</td>
<td></td>
</tr>
</tbody>
</table>
<p>Here are some graphs from OpenOffice to visualize this information.</p>

<a href='http://www.nalinmakar.com/2010/03/23/my-toyota-camrys-mileage/toyota_camry_mileage/' title='Toyota Camry Mileage'><img width="150" height="150" src="http://www.nalinmakar.com/blog/wp-content/uploads/2010/03/toyota_camry_mileage-150x150.jpg" class="attachment-thumbnail" alt="Toyota Camry Mileage" title="Toyota Camry Mileage" /></a>
<a href='http://www.nalinmakar.com/2010/03/23/my-toyota-camrys-mileage/toyota_camry_average_travel/' title='Toyota Camry Average Travel'><img width="150" height="150" src="http://www.nalinmakar.com/blog/wp-content/uploads/2010/03/toyota_camry_average_travel-150x150.jpg" class="attachment-thumbnail" alt="Average miles traveled in my Toyota Camry" title="Toyota Camry Average Travel" /></a>
<a href='http://www.nalinmakar.com/2010/03/23/my-toyota-camrys-mileage/toyota_camry_miles/' title='Toyota Camry Miles Travelled'><img width="150" height="150" src="http://www.nalinmakar.com/blog/wp-content/uploads/2010/03/toyota_camry_miles-150x150.jpg" class="attachment-thumbnail" alt="Toyota Camry Miles Travelled" title="Toyota Camry Miles Travelled" /></a>
<a href='http://www.nalinmakar.com/2010/03/23/my-toyota-camrys-mileage/toyota_camry_gas_price/' title='Gas Prices'><img width="150" height="150" src="http://www.nalinmakar.com/blog/wp-content/uploads/2010/03/toyota_camry_gas_price-150x150.jpg" class="attachment-thumbnail" alt="Gas Prices" title="Gas Prices" /></a>

<p style="text-align: center;">
<p>Hopefully this information is helpful to someone.</p>
<h3  class="related_post_title">Random Posts</h3><ul class="related_post"><li><a href="http://www.nalinmakar.com/2006/04/28/quarter-life-crisis/" title="Quarter Life Crisis">Quarter Life Crisis</a></li><li><a href="http://www.nalinmakar.com/2007/03/24/shooter/" title="Shooter">Shooter</a></li><li><a href="http://www.nalinmakar.com/2006/04/15/v-for-vendetta/" title="V for Vendetta">V for Vendetta</a></li><li><a href="http://www.nalinmakar.com/2008/12/13/connect-to-ms-sql-server-using-jdbc/" title="Connect to MS SQL Server using JDBC">Connect to MS SQL Server using JDBC</a></li><li><a href="http://www.nalinmakar.com/2006/06/01/bye-bye-globat-hello-1and1/" title="Bye Bye Globat, Hello 1and1">Bye Bye Globat, Hello 1and1</a></li><li><a href="http://www.nalinmakar.com/2005/11/02/i/" title="?">?</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.nalinmakar.com/2010/03/23/my-toyota-camrys-mileage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>pedo? maybe not :-)</title>
		<link>http://www.nalinmakar.com/2010/03/19/pedo-maybe-not/</link>
		<comments>http://www.nalinmakar.com/2010/03/19/pedo-maybe-not/#comments</comments>
		<pubDate>Sat, 20 Mar 2010 01:01:26 +0000</pubDate>
		<dc:creator>Nalin</dc:creator>
				<category><![CDATA[Fun]]></category>
		<category><![CDATA[kids]]></category>
		<category><![CDATA[playmate]]></category>

		<guid isPermaLink="false">http://www.nalinmakar.com/?p=671</guid>
		<description><![CDATA[Found on door in a friend&#8217;s apartment complex in SF Random PostsHappy New YearHarry Pottersadistic thinkingLikingWordpress 2.0.1 releasedBlog Updated]]></description>
			<content:encoded><![CDATA[<p><a rel="lightbox" href="http://www.nalinmakar.com/blog/wp-content/uploads/2010/03/IMG_0197.jpg"><img class="size-medium wp-image-670" title="pedo" src="http://www.nalinmakar.com/blog/wp-content/uploads/2010/03/IMG_0197-286x300.jpg" alt="pedo ? maybe not... :)" width="286" height="300" /></a><br />
Found on door in a friend&#8217;s apartment complex in SF</p>
<h3  class="related_post_title">Random Posts</h3><ul class="related_post"><li><a href="http://www.nalinmakar.com/2005/07/17/cinderella-man-movie-review/" title="Cinderella Man">Cinderella Man</a></li><li><a href="http://www.nalinmakar.com/2008/12/17/this-door-is-alarmed/" title="This door is alarmed">This door is alarmed</a></li><li><a href="http://www.nalinmakar.com/2005/07/05/wow/" title="WOW">WOW</a></li><li><a href="http://www.nalinmakar.com/2006/01/24/narnia/" title="Narnia">Narnia</a></li><li><a href="http://www.nalinmakar.com/2005/09/16/transporter-2-movie-review/" title="Transporter 2">Transporter 2</a></li><li><a href="http://www.nalinmakar.com/2007/01/31/bill-gates-on-the-daily-show/" title="Bill Gates on The Daily Show">Bill Gates on The Daily Show</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.nalinmakar.com/2010/03/19/pedo-maybe-not/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running single test or class using TestNG and Ant</title>
		<link>http://www.nalinmakar.com/2009/12/23/running-single-test-or-class-using-testng-and-ant/</link>
		<comments>http://www.nalinmakar.com/2009/12/23/running-single-test-or-class-using-testng-and-ant/#comments</comments>
		<pubDate>Thu, 24 Dec 2009 01:50:15 +0000</pubDate>
		<dc:creator>Nalin</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[test]]></category>
		<category><![CDATA[testng]]></category>

		<guid isPermaLink="false">http://www.nalinmakar.com/?p=656</guid>
		<description><![CDATA[I have been using TestNG for a while now in the latest project that I am working on. We have developed a whole suite of tests for an application and TestNG has really served us well. When it comes to running tests, we find that people (developer, testers and others) usually are hesitant to use [...]]]></description>
			<content:encoded><![CDATA[<p>I have been using <a href="http://testng.org/doc/index.html">TestNG</a> for a while now in the latest project that I am working on. We have developed a whole suite of tests for an application and TestNG has really served us well.</p>
<p>When it comes to running tests, we find that people (developer, testers and others) usually are hesitant to use something that involves much learning or is different from how they are used to doing things currently. So, we found it very useful to provide utilities that made it easy for anyone to be able to pick up test artifacts and with-in a few steps be able to run tests to reproduce bugs. Because we are building our project using <a href="http://ant.apache.org/">ant</a>, it was easy to provide a <code>build.xml</code> with the test distribution that will able to run the TestNG tests. This keeps things simple and uniform.</p>
<p>The TestNG ant task uses TestNG suites defined in XML files to run tests. It doesn&#8217;t provide an easy way to run a single test method or all the test methods in a single class. Basically, anytime someone has to run a test using this task, they need to create an XML file specifying the class and method for that test in an XML file and then execute the ant task. This can be simplified by letting ant targets take care of setting up the XML file with the require test and then executing it.</p>
<p><em>It&#8217;s quite simple</em>. You just need to create a TestNG suite XML template, modify it with the parameters that the user passes in on command line and then execute the TestNG ant task. Here&#8217;s how this can be achieved. First, create a template XML file like the following at <code>${testng.templates}/testfn.xml</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;">&lt; !DOCTYPE suite SYSTEM <span style="color: #ff0000;">&quot;http://testng.org/testng-1.0.dtd&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;suite</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Single Method Suite&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;test</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Single Method Test&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;classes<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;class</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;@CLASS@&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;methods<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
               <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;exclude</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;.*&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
               <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;include</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;@TEST@&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
            <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/methods<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/class<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/classes<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/test<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/suite<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Now, you can add the following target to the build file:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;run-single-test&quot;</span> </span>
<span style="color: #009900;">         <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;run a specific test. Requires class.name property set to fully qualified name of test class and test.name property set to method name&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;condition</span> <span style="color: #000066;">property</span>=<span style="color: #ff0000;">&quot;propsSpecified&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;and<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;isset</span> <span style="color: #000066;">property</span>=<span style="color: #ff0000;">&quot;class.name&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;isset</span> <span style="color: #000066;">property</span>=<span style="color: #ff0000;">&quot;test.name&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/and<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/condition<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fail</span> <span style="color: #000066;">unless</span>=<span style="color: #ff0000;">&quot;propsSpecified&quot;</span> </span>
<span style="color: #009900;">            <span style="color: #000066;">message</span>=<span style="color: #ff0000;">&quot;class.name and/or test.name property not specified.&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;copy</span> <span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${tmp.dir}&quot;</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${testng.templates}/testfn.xml&quot;</span> <span style="color: #000066;">overwrite</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filterset<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter</span> <span style="color: #000066;">token</span>=<span style="color: #ff0000;">&quot;CLASS&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${class.name}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter</span> <span style="color: #000066;">token</span>=<span style="color: #ff0000;">&quot;TEST&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${test.name}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filterset<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/copy<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;testng</span> <span style="color: #000066;">classpathref</span>=<span style="color: #ff0000;">&quot;lib.path&quot;</span></span>
<span style="color: #009900;">           <span style="color: #000066;">outputDir</span>=<span style="color: #ff0000;">&quot;${results.dir}/${DSTAMP}.${TSTAMP}-single-test-${class.name}-${test.name}&quot;</span></span>
<span style="color: #009900;">           <span style="color: #000066;">workingDir</span>=<span style="color: #ff0000;">&quot;${results.dir}/${DSTAMP}.${TSTAMP}-single-test-${class.name}-${test.name}&quot;</span></span>
<span style="color: #009900;">           <span style="color: #000066;">verbose</span>=<span style="color: #ff0000;">&quot;2&quot;</span></span>
<span style="color: #009900;">           <span style="color: #000066;">useDefaultListeners</span>=<span style="color: #ff0000;">&quot;false&quot;</span></span>
<span style="color: #009900;">           <span style="color: #000066;">listeners</span>=<span style="color: #ff0000;">&quot;${testng.listeners}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;xmlfileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${tmp.dir}&quot;</span> <span style="color: #000066;">includes</span>=<span style="color: #ff0000;">&quot;testfn.xml&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;jvmarg</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;-Xmx1024m&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/testng<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>The target picks the testfn.xml file, replaces the tokens with the specified input and copies it to the temp location. Now, the TestNG task can use this updated XML file to run tests. This target is invoked as:</p>
<p><code>ant run-single-test -Dclass.name=com.nalinmakar.testng.ant.Demo -Dtest.name=Test1</code></p>
<p>for the following class:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">com.nalinmakar.testng.ant</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Demo
<span style="color: #009900;">&#123;</span>
   @Test
   <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> Test1<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
   <span style="color: #009900;">&#123;</span>
      <span style="color: #666666; font-style: italic;">//do something</span>
   <span style="color: #009900;">&#125;</span>
   @Test
   <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> Test2<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
   <span style="color: #009900;">&#123;</span>
      <span style="color: #666666; font-style: italic;">//do something</span>
   <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Similarly, you can also create a template and another ant target for running all the test methods in a class:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;">&lt; !DOCTYPE suite SYSTEM <span style="color: #ff0000;">&quot;http://testng.org/testng-1.0.dtd&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;suite</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Single Class Suite&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;test</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Class Test&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;classes<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;class</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;@CLASS@&quot;</span>  <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
       <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/classes<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/test<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/suite<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;run-class&quot;</span></span>
<span style="color: #009900;">        <span style="color: #000066;">description</span>=<span style="color: #ff0000;">&quot;run all methods in a specific test class. Requires class.name property to be set to fully qualified name of class&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;condition</span> <span style="color: #000066;">property</span>=<span style="color: #ff0000;">&quot;classNameSpecified&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;isset</span> <span style="color: #000066;">property</span>=<span style="color: #ff0000;">&quot;class.name&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/condition<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fail</span> <span style="color: #000066;">unless</span>=<span style="color: #ff0000;">&quot;classNameSpecified&quot;</span></span>
<span style="color: #009900;">         <span style="color: #000066;">message</span>=<span style="color: #ff0000;">&quot;class.name property not specified. Don't know which test class to run.&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;copy</span> <span style="color: #000066;">todir</span>=<span style="color: #ff0000;">&quot;${tmp.dir}&quot;</span> <span style="color: #000066;">file</span>=<span style="color: #ff0000;">&quot;${testng.templates}/class.xml&quot;</span> <span style="color: #000066;">overwrite</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filterset<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
         <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;filter</span> <span style="color: #000066;">token</span>=<span style="color: #ff0000;">&quot;CLASS&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;${class.name}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/filterset<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/copy<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;testng</span> <span style="color: #000066;">classpathref</span>=<span style="color: #ff0000;">&quot;lib.path&quot;</span></span>
<span style="color: #009900;">           <span style="color: #000066;">outputDir</span>=<span style="color: #ff0000;">&quot;${results.dir}/${DSTAMP}.${TSTAMP}-class&quot;</span></span>
<span style="color: #009900;">           <span style="color: #000066;">workingDir</span>=<span style="color: #ff0000;">&quot;${results.dir}/${DSTAMP}.${TSTAMP}-class&quot;</span></span>
<span style="color: #009900;">           <span style="color: #000066;">verbose</span>=<span style="color: #ff0000;">&quot;2&quot;</span></span>
<span style="color: #009900;">           <span style="color: #000066;">useDefaultListeners</span>=<span style="color: #ff0000;">&quot;false&quot;</span></span>
<span style="color: #009900;">           <span style="color: #000066;">listeners</span>=<span style="color: #ff0000;">&quot;${testng.listeners}&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;jvmarg</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;-Xmx1024m&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
      <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;xmlfileset</span> <span style="color: #000066;">dir</span>=<span style="color: #ff0000;">&quot;${tmp.dir}&quot;</span> <span style="color: #000066;">includes</span>=<span style="color: #ff0000;">&quot;class.xml&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
   <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/testng<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/target<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>and can invoke this as </p>
<p><code>ant run-single-test -Dclass.name=com.nalinmakar.testng.ant.Demo</code></p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.nalinmakar.com/2010/07/28/logging-tests-to-separate-files/" title="Logging tests to separate files">Logging tests to separate files</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.nalinmakar.com/2009/12/23/running-single-test-or-class-using-testng-and-ant/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Nalin at Tech Museum</title>
		<link>http://www.nalinmakar.com/2009/12/23/nalin-at-tech-museum/</link>
		<comments>http://www.nalinmakar.com/2009/12/23/nalin-at-tech-museum/#comments</comments>
		<pubDate>Wed, 23 Dec 2009 19:56:58 +0000</pubDate>
		<dc:creator>Nalin</dc:creator>
				<category><![CDATA[Fun]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[museum]]></category>
		<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://www.nalinmakar.com/2009/12/23/nalin-at-tech-museum/</guid>
		<description><![CDATA[&#8220;Nalin Makar&#8221; was at The Tech Museum in San Jose Random PostsBlog&#8217;s software upgardedWatching the Future shape upPoseidonTalk with Tattoo Brand ConsultingSuSE Linux 9.3 ProfessionalEurotrip]]></description>
			<content:encoded><![CDATA[<p>&#8220;Nalin Makar&#8221; was at The Tech Museum in San Jose <img src='http://www.nalinmakar.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><a rel="lightbox" href="http://www.nalinmakar.com/blog/wp-content/uploads/2010/03/l_2048_1536_271261D1-B91D-4491-8F69-7642F76AB498.jpeg"><img class="alignnone size-full" src="http://www.nalinmakar.com/blog/wp-content/uploads/2010/03/l_2048_1536_271261D1-B91D-4491-8F69-7642F76AB498.jpeg" alt="" width="640" height="480" /></a></p>
<h3  class="related_post_title">Random Posts</h3><ul class="related_post"><li><a href="http://www.nalinmakar.com/2005/11/01/happy-diwali/" title="Happy Diwali">Happy Diwali</a></li><li><a href="http://www.nalinmakar.com/2006/05/07/the-sentinel/" title="The Sentinel">The Sentinel</a></li><li><a href="http://www.nalinmakar.com/2006/04/11/man-wants-to-sell-wifes-box/" title="Man wants to sell wife&#8217;s box">Man wants to sell wife&#8217;s box</a></li><li><a href="http://www.nalinmakar.com/2005/09/14/mulholland-drive-movie-review/" title="Mulholland Drive">Mulholland Drive</a></li><li><a href="http://www.nalinmakar.com/2006/04/10/i-am/" title="I am&#8230;">I am&#8230;</a></li><li><a href="http://www.nalinmakar.com/2006/03/29/google-vids/" title="Google Vids">Google Vids</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.nalinmakar.com/2009/12/23/nalin-at-tech-museum/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fix &#8220;500 Internal Error&#8221; in WordPress</title>
		<link>http://www.nalinmakar.com/2009/11/30/fix-500-internal-error-in-wordpress/</link>
		<comments>http://www.nalinmakar.com/2009/11/30/fix-500-internal-error-in-wordpress/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 00:59:54 +0000</pubDate>
		<dc:creator>Nalin</dc:creator>
				<category><![CDATA[wordpress]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[internal]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[upload]]></category>

		<guid isPermaLink="false">http://www.nalinmakar.com/?p=645</guid>
		<description><![CDATA[I recently upgraded my WordPress installation to the latest version (2.8.6) and started running into issues with uploading images. Every time I tried using the Flash Uploader I would see HTTP Error. On trying to use the non-flash browser based uploader, I saw the following: Error 500 &#8211; Internal server error An internal server error [...]]]></description>
			<content:encoded><![CDATA[<p>I recently upgraded my WordPress installation to the latest version (2.8.6) and started running into issues with uploading images. Every time I tried using the Flash Uploader I would see</p>
<blockquote><p><span style="color: #ff0000;">HTTP Error.</span></p></blockquote>
<p>On trying to use the non-flash browser based uploader, I saw the following:</p>
<blockquote><p><strong><span style="color: #000080;">Error 500 &#8211; Internal server error</span></strong><br />
An internal server error has occured!<br />
Please try again later.</p></blockquote>
<p>I googled quite a bit and finally found a solution. This error can happen because of quite a few different reasons:</p>
<ol>
<li>Incompatible plugins</li>
<li>Incorrect .htaccess file contents</li>
<li>PHP running out of memory</li>
<li>Incorrect file permissions</li>
<li>Not using PHP5</li>
</ol>
<h4>Incompatible plugins</h4>
<p>Easiest way to find if this is the issue is to deactivate all plug-ins and see if the issue still persists. If it goes away you can activate each plug-in one by one to find the culprit. You can read more on managing plug-ins <a href="http://codex.wordpress.org/Managing_Plugins">here</a>.</p>
<h4>Incorrect .htaccess file contents</h4>
<p>For some people, the issue went away after fixing the <code>.htaccess</code> file contents. You need to ensure that the .htaccess file at root of your website has the following contents:</p>
<pre># BEGIN WordPress
&lt;IfModule mod_rewrite.c&gt;
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
&lt;/IfModule&gt;
# END WordPress</pre>
<p>You can read more about it <a href="http://edwardkhoo.com/internal-server-error-500-for-wordpress-blog/">here</a>.</p>
<h4>PHP running out of Memory</h4>
<p>This can happen if you are using some memory hungry plug-ins. You can fix this issue by adding a <code>php.ini</code> file in <code>&lt;wordpresss_root&gt;/wp-admin</code> folder with the following contents:</p>
<pre>memory=20MB</pre>
<p>You can read more about this at <a href="http://www.codedifferent.com/2009/01/12/solution-for-500-internal-server-error-after-upgrading-to-wordpress-27-at-1and1-server/">codedifferent.com</a>, where this is explained in more details.</p>
<h4>Incorrect file permissions</h4>
<p>WordPress can start acting up if the permissions on directories and files in WordPress installation aren&#8217;t set up properly. You can ensure that this is fixed by logging into your hosting provider and making sure all files and directories have permissions set to <strong>755</strong>.</p>
<p>Another issue that might lead to errors while uploading is certain security issues with files used for uploading. This can be fixed by using <a href="http://wordpress.org/extend/plugins/image-upload-http-error-fix/">Image Upload HTTP Error Fix</a> plug-in. Otherwise, you could edit .htaccess to add the following lines:</p>
<pre>#BEGIN Image Upload HTTP Error Fix
&lt;IfModule mod_security.c&gt;
&lt;Files async-upload.php&gt;
SecFilterEngine Off
SecFilterScanPOST Off
&lt;/Files&gt;
&lt;/IfModule&gt;
&lt;IfModule security_module&gt;
&lt;Files async-upload.php&gt;
SecFilterEngine Off
SecFilterScanPOST Off
&lt;/Files&gt;
&lt;/IfModule&gt;
&lt;IfModule security2_module&gt;
&lt;Files async-upload.php&gt;
SecFilterEngine Off
SecFilterScanPOST Off
&lt;/Files&gt;
&lt;/IfModule&gt;
#END Image Upload HTTP Error Fix</pre>
<h4>Not using PHP5</h4>
<p>Even after doing all the above, things weren&#8217;t working for me. That is when I came across <a href="http://wordpress.org/support/topic/274197">this post</a>, which explains that the issue could be because PHP5 wasn&#8217;t enabled. According to a <a href="http://faq.1and1.com/scripting_languages_supported/php/upgrade/6.html">help article on 1and1.com</a>, fix is to just add the following line in <code>.htaccess</code> file:</p>
<pre>#enable php5
AddType x-mapp-php5 .php</pre>
<p>This fixed the issue for me!</p>
<p>Hope this helps.</p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.nalinmakar.com/2008/12/06/removing-tags-from-posts-contents-in-wordpress/" title="Removing tags from Wordpress posts content">Removing tags from Wordpress posts content</a></li><li><a href="http://www.nalinmakar.com/2008/09/02/hemingwayex-15-final/" title="HemingwayEx 1.5 Final">HemingwayEx 1.5 Final</a></li><li><a href="http://www.nalinmakar.com/2008/04/29/hemingwayex-11-is-finally-here/" title="Hemingwayex 1.1 is finally here">Hemingwayex 1.1 is finally here</a></li><li><a href="http://www.nalinmakar.com/2007/12/02/hemingwayex-11-on-its-way/" title="HemingwayEx 1.1 on it&#8217;s way">HemingwayEx 1.1 on it&#8217;s way</a></li><li><a href="http://www.nalinmakar.com/2007/11/20/long-long-time-ago/" title="Long long time ago&#8230;">Long long time ago&#8230;</a></li><li><a href="http://www.nalinmakar.com/2007/07/15/say-hello-to-hemingwayex-10/" title="Say Hello to HemingwayEx 1.0">Say Hello to HemingwayEx 1.0</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.nalinmakar.com/2009/11/30/fix-500-internal-error-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
