<?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>cosminaru blog &#187; TestNG</title>
	<atom:link href="http://cosminaru.ro/blog/category/testng/feed/" rel="self" type="application/rss+xml" />
	<link>http://cosminaru.ro/blog</link>
	<description>home</description>
	<lastBuildDate>Fri, 26 Aug 2011 09:56:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>TestNG XSLT 1.0</title>
		<link>http://cosminaru.ro/blog/2009/01/20/testng-xslt-10/</link>
		<comments>http://cosminaru.ro/blog/2009/01/20/testng-xslt-10/#comments</comments>
		<pubDate>Tue, 20 Jan 2009 17:01:02 +0000</pubDate>
		<dc:creator>Cosmin Marginean</dc:creator>
				<category><![CDATA[TestNG]]></category>

		<guid isPermaLink="false">http://cosminaru.ro/blog/?p=97</guid>
		<description><![CDATA[TestNG-XSLT, a small project of mine, has finally made it to 1.0. It&#8217;s currently tested only with Firefox 3.x and Internet Explorer 7, but it will probably work on most modern browsers. For the moment I thought it is more important to target the popular browsers and leave the more exotic ones for later. Some [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://code.google.com/p/testng-xslt/">TestNG-XSLT</a>, a small project of mine, has finally made it to 1.0. It&#8217;s currently tested only with Firefox 3.x and Internet Explorer 7, but it will probably work on most modern browsers. For the moment I thought it is more important to target the popular browsers and leave the more exotic ones for later.</p>
<p>Some of noteworthy features that I&#8217;ve added since the project start:</p>
<ul>
<li><a href="http://code.google.com/p/testng-xslt/wiki/MavenPlugin">Maven plugin</a> with access to all transformer features and settings.</li>
<li>SVG pie chart with the overview of the pass/fail/skip status.</li>
<li>Configurable CSS style sheet &#8211; you can build your own &#8220;skin&#8221; by overwriting the built-in styles and setting the <code>testNgXslt.cssFile</code> parameter. More about this <a href="http://code.google.com/p/testng-xslt/wiki/UsingCustomCss">here</a>.</li>
<li>Ability to change the report title, to generate information about test durations and other settings configurable through <a href="http://code.google.com/p/testng-xslt/wiki/XSLParameters">XSL transformer parameters</a>.</li>
<li>Other smaller or bigger <a href="http://code.google.com/p/testng-xslt/issues/list?can=1&#038;q=&#038;colspec=ID+Type+Status+Priority+Milestone+Owner+Summary&#038;cells=tiles">issues</a> and feature requests reported by users.</li>
</ul>
<p>I want to thank all the guys that used this and came up with bugs, feature requests and suggestions: Andreas Guther, Xuan Ngo, Francis Henninger, Csongor Gyuricza, Andreas Kuhtz and others.</p>
<p>Last, but not least, I would like to mention that Haw-Bin Chai has managed to successfully integrate TestNG-XSLT in <a href="http://stressfreetesting.com/">Lightest</a>, a lightweight testing framework based on TestNG and Groovy.</p>
<p>The download is available <a href="http://testng-xslt.googlecode.com/files/testng-xslt-1.0.zip">here</a>. If you use Maven, make sure you update your pom.xml to get the 1.0.9 version of the plugin.</p>
]]></content:encoded>
			<wfw:commentRss>http://cosminaru.ro/blog/2009/01/20/testng-xslt-10/feed/</wfw:commentRss>
		<slash:comments>326</slash:comments>
		</item>
		<item>
		<title>Maven plugin for TestNG XSLT</title>
		<link>http://cosminaru.ro/blog/2008/04/07/maven-plugin-for-testng-xslt/</link>
		<comments>http://cosminaru.ro/blog/2008/04/07/maven-plugin-for-testng-xslt/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 06:59:10 +0000</pubDate>
		<dc:creator>Cosmin Marginean</dc:creator>
				<category><![CDATA[TestNG]]></category>

		<guid isPermaLink="false">http://cosminaru.ro/blog/2008/04/07/maven-plugin-for-testng-xslt/</guid>
		<description><![CDATA[I finally got the time to finalize the Maven plugin for TestNG XSLT. A detailed usage scenario is described here. A few important notes: Integration with the Maven site (navigation link in the &#8220;Project Reports&#8221; section) CSS customization is performed by passing a cssFile configuration parameter to the plugin]]></description>
			<content:encoded><![CDATA[<p>I finally got the time to finalize the Maven plugin for <a href="http://code.google.com/p/testng-xslt/" target="_blank">TestNG XSLT</a>. A detailed usage scenario is described <a href="http://code.google.com/p/testng-xslt/wiki/MavenPlugin" target="_blank">here</a>.</p>
<p>A few important notes:</p>
<ul>
<li>Integration with the Maven site (navigation link in the &#8220;Project Reports&#8221; section)</li>
<li>CSS customization is performed by passing a <code>cssFile</code> configuration parameter to the plugin</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://cosminaru.ro/blog/2008/04/07/maven-plugin-for-testng-xslt/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>TestNG XSL-based reports</title>
		<link>http://cosminaru.ro/blog/2008/03/16/testng-xsl-based-reports/</link>
		<comments>http://cosminaru.ro/blog/2008/03/16/testng-xsl-based-reports/#comments</comments>
		<pubDate>Sun, 16 Mar 2008 20:56:56 +0000</pubDate>
		<dc:creator>Cosmin Marginean</dc:creator>
				<category><![CDATA[TestNG]]></category>

		<guid isPermaLink="false">http://cosminaru.ro/blog/2008/03/16/testng-xsl-based-reports/</guid>
		<description><![CDATA[As mentioned in a previous post, starting with the 5.6 version of TestNG, we have the ability to get an XML report (in the testng-results.xml file) that takes in consideration most of the TestNG features that are not available in the JUnit-compatible XML results. Although my spare time was fairly limited lately, I finally managed [...]]]></description>
			<content:encoded><![CDATA[<p>As mentioned in a <a href="http://cosminaru.ro/blog/2007/04/26/testng-56-is-out/">previous post</a>, starting with the 5.6 version of TestNG, we have the ability to get an XML report (in the testng-results.xml file) that takes in consideration most of the TestNG features that are not available in the JUnit-compatible XML results. Although my spare time was fairly limited lately, I finally managed to create a project for an XSL transformer to handle these reports, in order to provide a useful and user-friendly output for TestNG, as an alternative to the classic HTML reports.</p>
<p>The project is currently hosted on Google Code at <a href="http://code.google.com/p/testng-xslt">http://code.google.com/p/testng-xslt</a> and the current version is 0.2. For the moment you can only get it from the SVN repository, but that will change as soon as I&#8217;ll have some time to write some decent documentation and pack it with a download zip. Some sample generated reports are available at <a href="http://cosminaru.ro/test/testng-xslt">http://cosminaru.ro/test/testng-xslt</a>.</p>
<p>To get started, you can call <code>ant test</code> in the project base directory to see it running with a sample set of data. Your output should be generated in the <code>test/single/output</code> subdirectory. You can also use the <code>build.xml</code> file as a sample of integrating this with Ant and the output of a TestNG test run. Please take in consideration that the module is relying on lots of XSL 2.0 features. As far as I can tell, the only current implementation for that is <a href="http://saxon.sourceforge.net/">Saxon</a>, but you don&#8217;t have to worry about that since is bundled in the <code>lib</code> directory of the project.</p>
]]></content:encoded>
			<wfw:commentRss>http://cosminaru.ro/blog/2008/03/16/testng-xsl-based-reports/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>TestNG 5.6 is out</title>
		<link>http://cosminaru.ro/blog/2007/04/26/testng-56-is-out/</link>
		<comments>http://cosminaru.ro/blog/2007/04/26/testng-56-is-out/#comments</comments>
		<pubDate>Wed, 30 Nov -0001 00:00:00 +0000</pubDate>
		<dc:creator>Cosmin Marginean</dc:creator>
				<category><![CDATA[TestNG]]></category>

		<guid isPermaLink="false">http://www.cosminaru.ro/blog/?p=4</guid>
		<description><![CDATA[Yes, the 5.6 version of TestNG is finally out and contains several new features and a couple of bug fixes for both the core and IDE plugins. The complete list of these can be found here. One of the noteworthy fresh features of 5.6 that I would like to talk about is the new XML [...]]]></description>
			<content:encoded><![CDATA[<p>Yes, the 5.6 version of <a href="http://testng.org" target="_blank">TestNG</a> is finally out and contains several new features and a couple of bug fixes for both the core and IDE plugins. The complete list of these can be found <a href="http://testng.googlecode.com/svn/trunk/CHANGES.txt" target="_blank">here</a>.<br />
One of the noteworthy fresh features of 5.6 that I would like to talk about is the new XML reporter. This reporter provides additional TestNG-specific info that is not available in the JUnit-compatible report. It aims at helping automatic results reporting systems by promoting a consistent XML format, while also offering the foundation for obtaining user-friendly results.<br />
The documentation for this feature along with a sample XML output is available <a href="http://testng.org/doc/documentation-main.html#logging-xml-reports" target="_blank">here</a>. You might have noticed that the XML is class-centric. This means, that no matter how you specify your test scenarios, you will always get the output built around the classes whose methods were the subject of unit testing.<br />
As you might have expected, this reporter is included in the list of default listeners so you don&#8217;t have to enable it by hand. It&#8217;s output will be written in the same directory as the rest of the default reports (the TestNG output folder) in a file named <strong>testng-results.xml</strong>.<br />
There are however a couple of settings and tweaks that can be used to fine-tune the reporter to best fit your needs, as you might have noticed in the docs. These properties are passed in a JavaBeans style as we will see later.<br />
One of these properties that you might find useful is the <code>fileFragmentationLevel</code> integer. This property provides a way to control the structure of the generated XML files by allowing you to separate the files into smaller pieces if you consider that one single XML file is too big to chew at once.<br />
For the beginning, if you have more than one suite in your tests, you can choose to have the results for each suite in a separate XML file (by setting <code>fileFragmentationLevel</code> to 2). This way, the main file will only reference the suite files, as you can see here:</p>
<pre class="prettyprint"><code>&#60;&#116;&#101;&#115;&#116;&#110;&#103;&#45;&#114;&#101;&#115;&#117;&#108;&#116;&#115;&#62;&#10;&#32;&#32;&#60;&#115;&#117;&#105;&#116;&#101;&#32;&#117;&#114;&#108;&#61;&#34;&#83;&#117;&#105;&#116;&#101;&#49;&#47;&#116;&#101;&#115;&#116;&#110;&#103;&#45;&#114;&#101;&#115;&#117;&#108;&#116;&#115;&#46;&#120;&#109;&#108;&#34;&#47;&#62;&#10;&#60;&#47;&#116;&#101;&#115;&#116;&#110;&#103;&#45;&#114;&#101;&#115;&#117;&#108;&#116;&#115;&#62;</code></pre>
<p>The suite file will only contain the <code>&lt;suite&gt;</code> element with the same structure as before:</p>
<pre class="prettyprint"><code>&#60;&#115;&#117;&#105;&#116;&#101;&#32;&#110;&#97;&#109;&#101;&#61;&#34;&#83;&#117;&#105;&#116;&#101;&#49;&#34;&#62;&#10;&#32;&#32;&#60;&#103;&#114;&#111;&#117;&#112;&#115;&#62;&#10;&#32;&#32;&#46;&#46;&#46;&#10;&#32;&#32;&#60;&#47;&#103;&#114;&#111;&#117;&#112;&#115;&#62;&#10;&#10;&#32;&#32;&#60;&#116;&#101;&#115;&#116;&#32;&#110;&#97;&#109;&#101;&#61;&#34;&#116;&#101;&#115;&#116;&#49;&#34;&#62;&#10;&#32;&#32;&#32;&#32;&#60;&#99;&#108;&#97;&#115;&#115;&#32;&#110;&#97;&#109;&#101;&#61;&#34;&#99;&#111;&#109;&#46;&#116;&#101;&#115;&#116;&#46;&#84;&#101;&#115;&#116;&#79;&#110;&#101;&#34;&#62;&#10;&#32;&#32;&#32;&#32;&#46;&#46;&#46;&#10;&#32;&#32;&#32;&#32;&#60;&#47;&#99;&#108;&#97;&#115;&#115;&#62;&#10;&#32;&#32;&#60;&#47;&#116;&#101;&#115;&#116;&#62;&#10;&#60;&#47;&#115;&#117;&#105;&#116;&#101;&#62;</code></pre>
<p>If you want to go even deeper with this, you can have your suite test-cases written in separate files, for which you will have to set <code>fileFragmentationLevel</code> to 3.<br />
In this case, besides the previous <em>effects</em>, you will also get the test-cases files referenced from the suite files:</p>
<pre class="prettyprint"><code>&#60;&#115;&#117;&#105;&#116;&#101;&#32;&#110;&#97;&#109;&#101;&#61;&#34;&#83;&#117;&#105;&#116;&#101;&#49;&#34;&#62;&#10;&#32;&#32;&#60;&#103;&#114;&#111;&#117;&#112;&#115;&#62;&#10;&#32;&#32;&#46;&#46;&#46;&#10;&#32;&#32;&#60;&#47;&#103;&#114;&#111;&#117;&#112;&#115;&#62;&#10;&#32;&#32;&#60;&#116;&#101;&#115;&#116;&#32;&#117;&#114;&#108;&#61;&#34;&#116;&#101;&#115;&#116;&#49;&#46;&#120;&#109;&#108;&#34;&#47;&#62;&#10;&#60;&#47;&#115;&#117;&#105;&#116;&#101;&#62;&#10;</code></pre>
<p>and as you probably guessed, <code>test1.xml</code> looks like this:</p>
<pre class="prettyprint"><code>&#60;&#116;&#101;&#115;&#116;&#32;&#110;&#97;&#109;&#101;&#61;&#34;&#116;&#101;&#115;&#116;&#49;&#34;&#62;&#10;&#32;&#32;&#60;&#99;&#108;&#97;&#115;&#115;&#32;&#110;&#97;&#109;&#101;&#61;&#34;&#99;&#111;&#109;&#46;&#116;&#101;&#115;&#116;&#46;&#84;&#101;&#115;&#116;&#79;&#110;&#101;&#34;&#62;&#10;&#32;&#32;&#46;&#46;&#46;&#10;&#32;&#32;&#60;&#47;&#99;&#108;&#97;&#115;&#115;&#62;&#10;&#60;&#47;&#116;&#101;&#115;&#116;&#62;&#10;</code></pre>
<p>The next question would be &#8220;how the hell do I set <code>fileFragmentationLevel</code> and the other properties?&#8221;. The <a href="http://testng.org/doc/documentation-main.html#logging-xml-reports" target="_blank">docs</a> also mentions this stuff and you should read that before doing anything else. However, I can detail a little bit about the most common ways to configure this reporter.<br />
The first thing you need to know is that in 5.6, along with the other changes, there is also a new method to inject custom report listeners providing fine-grained access to their behavior. The foundation of this is the new <code>-reporter</code> argument that can be passed from the command line. The docs about this are <a href="http://testng.org/doc/documentation-main.html#running-testng" target="_blank">here</a>. This will inject a reporter like <code>-listener</code> would, but it also allows you to set some properties on it.<br />
In our case, if for example we would like to change <code>fileFragmentationLevel</code> and <code>outputDirectory</code> of the XML reporter, we would pass to the command line something like this:</p>
<pre class="prettyprint"><code>-reporter org.testng.reporters.XMLReporter:fileFragmentationLevel=2,outputDirectory=/usr/temp/results</code></pre>
<p>There is also an <a href="http://testng.org/doc/ant.html" target="_blank">Ant</a> equivalent for this type of configuration, and it can be achieved by using the inner <code>&lt;reporter&gt;</code> element, which in our case would be something like this:</p>
<pre class="prettyprint"><code>&#60;&#116;&#97;&#114;&#103;&#101;&#116;&#32;&#110;&#97;&#109;&#101;&#61;&#34;&#116;&#101;&#115;&#116;&#34;&#32;&#100;&#101;&#112;&#101;&#110;&#100;&#115;&#61;&#34;&#98;&#117;&#105;&#108;&#100;&#34;&#62;&#10;&#32;&#32;&#60;&#116;&#101;&#115;&#116;&#110;&#103;&#32;&#46;&#46;&#46;&#62;&#10;&#32;&#32;&#32;&#32;&#60;&#114;&#101;&#112;&#111;&#114;&#116;&#101;&#114;&#32;&#99;&#108;&#97;&#115;&#115;&#110;&#97;&#109;&#101;&#61;&#34;&#111;&#114;&#103;&#46;&#116;&#101;&#115;&#116;&#110;&#103;&#46;&#114;&#101;&#112;&#111;&#114;&#116;&#101;&#114;&#115;&#46;&#88;&#77;&#76;&#82;&#101;&#112;&#111;&#114;&#116;&#101;&#114;&#34;&#62;&#10;&#32;&#32;&#32;&#32;&#32;&#32;&#60;&#112;&#114;&#111;&#112;&#101;&#114;&#116;&#121;&#32;&#110;&#97;&#109;&#101;&#61;&#34;&#102;&#105;&#108;&#101;&#70;&#114;&#97;&#103;&#109;&#101;&#110;&#116;&#97;&#116;&#105;&#111;&#110;&#76;&#101;&#118;&#101;&#108;&#34;&#32;&#118;&#97;&#108;&#117;&#101;&#61;&#34;&#50;&#34;&#47;&#62;&#10;&#32;&#32;&#32;&#32;&#32;&#32;&#60;&#112;&#114;&#111;&#112;&#101;&#114;&#116;&#121;&#32;&#110;&#97;&#109;&#101;&#61;&#34;&#111;&#117;&#116;&#112;&#117;&#116;&#68;&#105;&#114;&#101;&#99;&#116;&#111;&#114;&#121;&#34;&#32;&#118;&#97;&#108;&#117;&#101;&#61;&#34;&#47;&#117;&#115;&#114;&#47;&#116;&#101;&#109;&#112;&#47;&#114;&#101;&#115;&#117;&#108;&#116;&#115;&#34;&#47;&#62;&#10;&#32;&#32;&#32;&#32;&#60;&#47;&#114;&#101;&#112;&#111;&#114;&#116;&#101;&#114;&#62;&#10;&#32;&#32;&#32;&#32;&#46;&#46;&#46;&#10;&#32;&#32;&#60;&#47;&#116;&#101;&#115;&#116;&#110;&#103;&#62;&#10;&#60;&#47;&#116;&#97;&#114;&#103;&#101;&#116;&#62;&#10;</code></pre>
<p>This kind of configuration can be used starting with TestNG 5.6 for any of your custom listeners, not just the XML reporter. There are however a couple of things here that must be considered. First of all, the types that are currently supported as reporter properties are limited to the following set: java.lang.String, int, boolean, byte, char, double, float, long, short. Besides, as you might have noticed, it might be a little tricky to pass strings containing commas as parameters, although it can be easily worked-around.<br />
Another thing, strictly related to the XML reporter, is that the built-in reporter can only use the default settings, an issue also mentioned by the documentation. You can however inject a new instance of this reporter manually with one of the methods described above (yes, the above code will create a new instance, and it will not configure the default one). However, in order not to get into conflicts with the built-in reporter you have two options: one is to disable the default listeners and the other one is to change the output directory of the manually injected instance (they both worked for me).</p>
<p>Hope you find this useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://cosminaru.ro/blog/2007/04/26/testng-56-is-out/feed/</wfw:commentRss>
		<slash:comments>352</slash:comments>
		</item>
	</channel>
</rss>

