<?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>maxheapsize.com &#187; quant</title>
	<atom:link href="http://maxheapsize.com/tag/quant/feed/" rel="self" type="application/rss+xml" />
	<link>http://maxheapsize.com</link>
	<description>Oliver Wehrens on Programming and Agile</description>
	<lastBuildDate>Tue, 14 Jun 2011 20:41:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Update on Quant TestTester</title>
		<link>http://maxheapsize.com/2009/06/25/update-on-quant-testtester/</link>
		<comments>http://maxheapsize.com/2009/06/25/update-on-quant-testtester/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 20:31:23 +0000</pubDate>
		<dc:creator>Oliver Wehrens</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[quant]]></category>
		<category><![CDATA[test]]></category>
		<category><![CDATA[testng]]></category>

		<guid isPermaLink="false">http://maxheapsize.com/?p=258</guid>
		<description><![CDATA[Here is a small update on my little fun project. I released version 0.2 of quant. Now it will recognize all TestNG annotations which do not have a TestNG group (like @BeforeMethod, @BeforeClass etc.). The method &#8216;reportViolation&#8217; on ClassTester will now report whats wrong with the examined class. [/java] assertFalse(classTester.isInvalidTestClass(), classTester.reportViolation()); [java] Above code will [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fmaxheapsize.com%2F2009%2F06%2F25%2Fupdate-on-quant-testtester%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fmaxheapsize.com%2F2009%2F06%2F25%2Fupdate-on-quant-testtester%2F&amp;source=owehrens&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Here is a small update on my little fun project.</p>
<p>I released version 0.2 of quant. Now it will recognize all TestNG annotations which do not have a TestNG group (like @BeforeMethod, @BeforeClass etc.). The method &#8216;reportViolation&#8217; on ClassTester will now report whats wrong with the examined class.</p>
<pre class="brush: java; title: ;">[/java]
 assertFalse(classTester.isInvalidTestClass(),
    classTester.reportViolation());
[java]</pre>
<p>Above code will now report:</p>
<pre>
java.lang.AssertionError:
Report for Class com.maxheapsize.quant.testclasses.SetupMethodWithoutTestGroup
Ignore abstract classes: true
Specified TestGroups :  + testUnitTest
* Methods with wrong test group:
  - testSetUp
</pre>
<p>In this way you know what went wrong and where to look for it.</p>
<p>Quant is now also available in my <a href="http://maxheapsize.com/maven2/com/maxheapsize/quant/">repository</a>. To include it add the following code to your pom.xml.</p>
<pre class="brush: xml; title: ;">
&lt;dependency&gt;
    &lt;groupId&gt;com.maxheapsize&lt;/groupId&gt;
    &lt;artifactId&gt;quant&lt;/artifactId&gt;
    &lt;version&gt;0.2&lt;/version&gt;
&lt;/dependency&gt;
</pre>
<p>For now you need to add my mvn repository to your pom. I&#8217;m about to have it mirrored to the official servers. </p>
<p>Have fun.</p>
<div class="google_plusone_widget"><g:plusone 
      count="true" href="http://maxheapsize.com/2009/06/25/update-on-quant-testtester/" size="medium"></g:plusone></div><!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://maxheapsize.com/2009/06/25/update-on-quant-testtester/&amp;title=Update+on+Quant+TestTester" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://maxheapsize.com/2009/06/25/update-on-quant-testtester/&amp;title=Update+on+Quant+TestTester" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.dzone.com/links/add.html?description=Update+on+Quant+TestTester&amp;url=http://maxheapsize.com/2009/06/25/update-on-quant-testtester/&amp;title=Update+on+Quant+TestTester" rel="nofollow" title="Add to&nbsp;DZone"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/dzone.png" title="Add to&nbsp;DZone" alt="Add to&nbsp;DZone" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://maxheapsize.com/2009/06/25/update-on-quant-testtester/" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://maxheapsize.com/2009/06/25/update-on-quant-testtester/&amp;title=Update+on+Quant+TestTester" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http://maxheapsize.com/2009/06/25/update-on-quant-testtester/&amp;bm_description=Update+on+Quant+TestTester" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://maxheapsize.com/2009/06/25/update-on-quant-testtester/&amp;title=Update+on+Quant+TestTester" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://maxheapsize.com/2009/06/25/update-on-quant-testtester/&amp;title=Update+on+Quant+TestTester" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.sphere.com/sphereit/http://maxheapsize.com/2009/06/25/update-on-quant-testtester/" rel="nofollow" title="Add to&nbsp;SphereIt"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/sphereit.png" title="Add to&nbsp;SphereIt" alt="Add to&nbsp;SphereIt" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.spurl.net/spurl.php?url=http://maxheapsize.com/2009/06/25/update-on-quant-testtester/&amp;title=Update+on+Quant+TestTester" rel="nofollow" title="Add to&nbsp;Spurl"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/spurl.png" title="Add to&nbsp;Spurl" alt="Add to&nbsp;Spurl" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://maxheapsize.com/2009/06/25/update-on-quant-testtester/" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Update+on+Quant+TestTester+@+http://maxheapsize.com/2009/06/25/update-on-quant-testtester/" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://maxheapsize.com/2009/06/25/update-on-quant-testtester/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quant &#8211; Check your Tests</title>
		<link>http://maxheapsize.com/2009/05/30/quant-check-your-tests/</link>
		<comments>http://maxheapsize.com/2009/05/30/quant-check-your-tests/#comments</comments>
		<pubDate>Sat, 30 May 2009 20:06:47 +0000</pubDate>
		<dc:creator>Oliver Wehrens</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[quant]]></category>
		<category><![CDATA[test]]></category>
		<category><![CDATA[testng]]></category>

		<guid isPermaLink="false">http://maxheapsize.com/?p=229</guid>
		<description><![CDATA[Did you ever wondered if all tests your team wrote are really running ? How many disabled tests does your code base have? How many public void methods do not have a @Test annotation (or at the class) ? I saw all of that in the last years. To overcome this situation I wrote a [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fmaxheapsize.com%2F2009%2F05%2F30%2Fquant-check-your-tests%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fmaxheapsize.com%2F2009%2F05%2F30%2Fquant-check-your-tests%2F&amp;source=owehrens&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p><img src="http://maxheapsize.com/static/QuantLogo.png" class="alignleft"/>Did you ever wondered if all tests your team wrote are <strong>really running</strong> ? How many <strong>disabled tests</strong> does your code base have? How many public void methods <strong>do not have a @Test</strong> annotation (or at the class) ? </p>
<p>I saw all of that in the last years.  </p>
<p>To overcome this situation I wrote a couple of java classes which will scan your java test sources and will examine the annotations (for TestNG, sorry JUnit). The code will detect if all public void methods do have a<code> @Test</code> annotation (either direct on the method or on the class) or if there are disabled tests. Both signals are most likely a sign of rotten code. </p>
<p>If you have different test groups defined like &#8216;unitTest&#8217; or &#8216;integrationTest&#8217; you want to make sure all tests are in at least one test group. This ensures if you run all test groups all tests are executed. </p>
<p>The usage is really <strong>simple</strong>. To make sure all your tests are ok is to <strong>write just another test</strong> which will check all tests.</p>
<pre class="brush: java; title: ;">
ClassFinder classFinder =
   new ClassFinder.Builder(sourceDirectory).build();
for (Class klass : classFinder.getClassList()) {
  TestClassTester testClassTester =
    new TestNGTestClassTester.Builder(klass).build();
  Assert.assertTrue(testClassTester.allTestMethodsHaveValidTestGroup());
}
</pre>
<p>You need to specify the source files of your code so that all java files can be scanned. It is possible to exclude certain packages to be checked (via <code>TestNGTestClassTester.Builder(klass).addExcludedPackage("testclasses").build()</code>). After gathering all class names from the sources the code will check for <code>@Test</code> annotations in the test classes. You can also specify the test groups which all test should belong to (via <code>addTestGroup("unitTest")</code> in the builder).</p>
<p>Finding disabled test methods is very simple too (one of the unit tests)</p>
<pre class="brush: java; title: ;">
@Test
public void testNoDisabledTest() {
  DisabledTestFinder unitUnderTest =
    new TestNGDisabledTestFinder.Builder(TwoTestGroups.class).build();
  assertFalse(unitUnderTest.hasDisabledTests());
}
</pre>
<p>This would test a single class (but you can of course feed it with the results of the ClassFinder).</p>
<p>If you combine the possibility to break your build because of defect test classes and a  <strong>continuous integration system</strong>, you can make sure everybody will annotate their classes correctly or never disables tests (or even better use a CI with delayed check in and personal build like Jetbrains Teamcity). Of course you can define your own thresholds for e.g. 30 disabled tests are allowed (I know sometimes you just can&#8217;t avoid it).</p>
<p>The code depends on testng and commons-io and is released under the Apache v2 license.</p>
<p>I still need to figure out where to put the maven2 sources. Either Google code or GitHub ? Any ideas? </p>
<p><strong>Update:</strong> Code is available at <a href="http://code.google.com/p/quant/source/checkout">Google Code Hosting</a>.</p>
<p>Things to implement:</p>
<ul>
<li>A more flexible exclude patterm, like Apache ant maybe</li>
<li>Make sure to check @BeforeXXX and @AfterXXX methods as well</li>
<li>Implement JUnit (maybe <img src='http://maxheapsize.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  )</li>
</ul>
<div class="google_plusone_widget"><g:plusone 
      count="true" href="http://maxheapsize.com/2009/05/30/quant-check-your-tests/" size="medium"></g:plusone></div><!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http://maxheapsize.com/2009/05/30/quant-check-your-tests/&amp;title=Quant+%26%238211%3B+Check+your+Tests" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http://maxheapsize.com/2009/05/30/quant-check-your-tests/&amp;title=Quant+%26%238211%3B+Check+your+Tests" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.dzone.com/links/add.html?description=Quant+%26%238211%3B+Check+your+Tests&amp;url=http://maxheapsize.com/2009/05/30/quant-check-your-tests/&amp;title=Quant+%26%238211%3B+Check+your+Tests" rel="nofollow" title="Add to&nbsp;DZone"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/dzone.png" title="Add to&nbsp;DZone" alt="Add to&nbsp;DZone" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http://maxheapsize.com/2009/05/30/quant-check-your-tests/" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://maxheapsize.com/2009/05/30/quant-check-your-tests/&amp;title=Quant+%26%238211%3B+Check+your+Tests" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.mister-wong.com/index.php?action=addurl&amp;bm_url=http://maxheapsize.com/2009/05/30/quant-check-your-tests/&amp;bm_description=Quant+%26%238211%3B+Check+your+Tests" rel="nofollow" title="Add to&nbsp;Mister Wong"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/misterwong.png" title="Add to&nbsp;Mister Wong" alt="Add to&nbsp;Mister Wong" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http://maxheapsize.com/2009/05/30/quant-check-your-tests/&amp;title=Quant+%26%238211%3B+Check+your+Tests" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit.php?url=http://maxheapsize.com/2009/05/30/quant-check-your-tests/&amp;title=Quant+%26%238211%3B+Check+your+Tests" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.sphere.com/sphereit/http://maxheapsize.com/2009/05/30/quant-check-your-tests/" rel="nofollow" title="Add to&nbsp;SphereIt"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/sphereit.png" title="Add to&nbsp;SphereIt" alt="Add to&nbsp;SphereIt" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.spurl.net/spurl.php?url=http://maxheapsize.com/2009/05/30/quant-check-your-tests/&amp;title=Quant+%26%238211%3B+Check+your+Tests" rel="nofollow" title="Add to&nbsp;Spurl"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/spurl.png" title="Add to&nbsp;Spurl" alt="Add to&nbsp;Spurl" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http://maxheapsize.com/2009/05/30/quant-check-your-tests/" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://twitter.com/home/?status=Check+out+Quant+%26%238211%3B+Check+your+Tests+@+http://maxheapsize.com/2009/05/30/quant-check-your-tests/" rel="nofollow" title="Add to&nbsp;Twitter"><img class="social_img" src="http://maxheapsize.com/wp-content/plugins/social-bookmarks/images/twitter.png" title="Add to&nbsp;Twitter" alt="Add to&nbsp;Twitter" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->
]]></content:encoded>
			<wfw:commentRss>http://maxheapsize.com/2009/05/30/quant-check-your-tests/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

