<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Extreme Pattern: Hello ant1.7 and junit4</title>
    <link>http://blog.extremepattern.com/articles/2006/12/13/hello-ant1-7-and-junit4</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>enjoy</description>
    <item>
      <title>Hello ant1.7 and junit4</title>
      <description>&lt;h3&gt;源起&lt;/h3&gt;


	&lt;p&gt;現在慢慢習慣使用 Junit4 寫測試，發現目前 eclipse 3.2  支援的 ant 1.6.5 
的 junit task 不支援 junit4，所以想試一下新的 ant1.7。&lt;/p&gt;


	&lt;h3&gt;junit 4&lt;/h3&gt;


	&lt;p&gt;除了 @Test 之外，目前測試 spring 的 bean 往往都是一次取得 application context
來測，這時候 @BeforeClass 也是很好用。&lt;/p&gt;


	&lt;h3&gt;ant 1.7&lt;/h3&gt;


	&lt;p&gt;目前是 RC 版，先下載 apache-ant-1.7.0RC1-bin.zip，解開為目錄。
然後開 eclipse 的 ant 設定，將其中的 Ant Home 換成 1.7 的目錄即可。&lt;/p&gt;


&lt;pre&gt;
&amp;lt;target name="test" depends="compile"&amp;gt;
  &amp;lt;junit printsummary="yes"&amp;gt;
    &amp;lt;classpath refid="supportlib.classpath"/&amp;gt;
    &amp;lt;formatter type="xml" /&amp;gt;
    &amp;lt;batchtest fork="yes" todir="${reports.tests}"&amp;gt;
      &amp;lt;fileset dir="${src.test}"&amp;gt;
        &amp;lt;include name="**/*Test*.java" /&amp;gt;
      &amp;lt;/fileset&amp;gt;
    &amp;lt;/batchtest&amp;gt;
  &amp;lt;/junit&amp;gt;
&amp;lt;/target&amp;gt;

&amp;lt;target name="report" depends="test"&amp;gt;
  &amp;lt;junitreport todir="${reports}"&amp;gt; 
    &amp;lt;fileset dir="${reports.tests}"&amp;gt; 
      &amp;lt;include name="TEST-*.xml"/&amp;gt; 
    &amp;lt;/fileset&amp;gt; 
    &amp;lt;report 
        format="frames" todir="${reports}/html"/&amp;gt; 
  &amp;lt;/junitreport&amp;gt; 
&amp;lt;/target&amp;gt;
&lt;/pre&gt;

	&lt;h3&gt;觀察&lt;/h3&gt;


	&lt;ol&gt;
	&lt;li&gt;雖然 junit 3 的支援比較完整，不過新東西還是要試一下。&lt;/li&gt;
	&lt;/ol&gt;</description>
      <pubDate>Wed, 13 Dec 2006 21:44:00 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:9c705561-465e-4876-92f0-459c550619df</guid>
      <author>LIN</author>
      <link>http://blog.extremepattern.com/articles/2006/12/13/hello-ant1-7-and-junit4</link>
      <category>java</category>
    </item>
  </channel>
</rss>

