<?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>Silicon Forks</title>
	<atom:link href="http://blog.siliconforks.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.siliconforks.com</link>
	<description></description>
	<lastBuildDate>Mon, 07 Jun 2010 18:01:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Ubuntu 10 times as popular as any other desktop Linux distribution?</title>
		<link>http://blog.siliconforks.com/2010/06/07/ubuntu-10-times-as-popular-as-any-other-desktop-linux-distribution/</link>
		<comments>http://blog.siliconforks.com/2010/06/07/ubuntu-10-times-as-popular-as-any-other-desktop-linux-distribution/#comments</comments>
		<pubDate>Mon, 07 Jun 2010 17:55:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.siliconforks.com/?p=113</guid>
		<description><![CDATA[The Wikimedia Foundation publishes monthly reports with a lot of useful information about the visitors to its various web sites (mostly Wikipedia). One interesting report shows the popularity of different operating systems. Not only does it show the number of visitors using Linux, but also it breaks down the Linux users by distribution. The below [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://wikimediafoundation.org/">Wikimedia Foundation</a> publishes <a href="http://stats.wikimedia.org/archive/squid_reports/">monthly reports</a> with a lot of useful information about the visitors to its various web sites (mostly <a href="http://wikipedia.org/">Wikipedia</a>).  One interesting report <a href="http://stats.wikimedia.org/archive/squid_reports/2010-05/SquidReportOperatingSystems.htm">shows the popularity of different operating systems</a>.  Not only does it show the number of visitors using Linux, but also it breaks down the Linux users by distribution.  The below chart summarizes the popularity of various distributions from April 2009 to May 2010.  (Note that the chart shows only desktop Linux distributions; e.g., it omits <a href="http://www.android.com/">Android</a>, the mobile distribution.)</p>
<p><a href="http://blog.siliconforks.com/wp-content/uploads/2010/06/linux-distributions.png"><img src="http://blog.siliconforks.com/wp-content/uploads/2010/06/linux-distributions.png" alt="Visitors to Wikimedia web sites by Linux distribution" title="Visitors to Wikimedia web sites by Linux distribution" width="800" height="700" class="alignnone size-full wp-image-117" /></a></p>
<p>Not surprisingly, <a href="http://ubuntu.com/">Ubuntu</a> is on top; this distribution is <a href="http://www.starryhope.com/articles/2009/ubuntu-still-popular/">often considered</a> to be the most popular among desktop users.  What is perhaps surprising is the magnitude of its popularity: in May 2010 it was more than <strong>10 times</strong> as popular as its nearest competitor (SUSE).</p>
<p>Of course, a few caveats are in order:</p>
<ul>
<li>Drawing broad conclusions based on the visitors to a particular web site can be problematic; the visitors to the web site may not be representative of all users.  (Still, Wikipedia is one of the most popular sites on the entire web, with literally billions of visits every month, from all over the world; it seems unlikely that Wikipedia&#8217;s visitor data would be heavily biased towards any particular desktop Linux distribution.)</li>
<li>Obviously, the data only measure desktop Linux users; they do not reflect the popularity of server Linux distributions.</li>
<li>In the data, not all Linux users are placed in a specific distribution; some are placed in a generic &#8220;Linux&#8221; category.  (Presumably the user&#8217;s browser did not report a specific distribution.)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.siliconforks.com/2010/06/07/ubuntu-10-times-as-popular-as-any-other-desktop-linux-distribution/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using JSCoverage with Selenium</title>
		<link>http://blog.siliconforks.com/2010/05/22/jscoverage-selenium/</link>
		<comments>http://blog.siliconforks.com/2010/05/22/jscoverage-selenium/#comments</comments>
		<pubDate>Sat, 22 May 2010 03:21:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JSCoverage]]></category>
		<category><![CDATA[Selenium]]></category>

		<guid isPermaLink="false">http://blog.siliconforks.com/?p=108</guid>
		<description><![CDATA[Many people have asked questions about using JSCoverage with a Selenium test suite. There are a number of different approaches to doing this (these will likely be discussed in detail in a future article on this blog). One method is described in &#8220;JSCoverage, cobertura and selenium,&#8221; on the Mercenary Code blog. This article demonstrates how [...]]]></description>
			<content:encoded><![CDATA[<p>Many people have asked questions about using <a href="http://siliconforks.com/jscoverage/">JSCoverage</a> with a <a href="http://seleniumhq.org/">Selenium</a> test suite.  There are a number of different approaches to doing this (these will likely be discussed in detail in a future article on this blog).  One method is described in &#8220;<a href="http://mercenary-code.blogspot.com/2010/05/jscoverage-cobertura-and-selenium.html">JSCoverage, cobertura and selenium</a>,&#8221; on the <a href="http://mercenary-code.blogspot.com">Mercenary Code blog</a>.  This article demonstrates how to access JSCoverage&#8217;s coverage data directly from the browser using a Selenium command, as well as how to create a custom report (in <a href="http://cobertura.sourceforge.net/">Cobertura</a>&#8216;s XML format) from that data.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.siliconforks.com/2010/05/22/jscoverage-selenium/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Monitor &#8220;out of range&#8221; when installing Ubuntu Lucid Lynx</title>
		<link>http://blog.siliconforks.com/2010/05/07/monitor-out-of-range-installing-ubuntu-lucid-lynx/</link>
		<comments>http://blog.siliconforks.com/2010/05/07/monitor-out-of-range-installing-ubuntu-lucid-lynx/#comments</comments>
		<pubDate>Fri, 07 May 2010 15:28:56 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.siliconforks.com/?p=96</guid>
		<description><![CDATA[On some computers, it seems that running the Ubuntu 10.04 (Lucid Lynx) installer (the standard desktop installer) results in a blank screen and the error message &#8220;out of range.&#8221; (At least, that was the error message generated on one monitor. The message was generated by the on-screen display of the monitor itself, so results may [...]]]></description>
			<content:encoded><![CDATA[<p>On some computers, it seems that running the <a href="http://www.ubuntu.com/">Ubuntu</a> 10.04 (Lucid Lynx) installer (the standard desktop installer) results in a blank screen and the error message &#8220;out of range.&#8221;</p>
<p>(At least, that was the error message generated on one monitor.  The message was generated by the on-screen display of the monitor itself, so results may vary.  You may observe a different error message, smoke coming out the back of the monitor, etc.)</p>
<p>You can read about it in <a href="http://ubuntuforums.org/showthread.php?t=1465447">this forum thread</a>; to summarize, the workaround is as follows:</p>
<ol>
<li>When running the installer, just before the error occurs, you will see this cryptic screen:
<p><a href="http://blog.siliconforks.com/wp-content/uploads/2010/05/ubuntu-out-of-range.png"><img src="http://blog.siliconforks.com/wp-content/uploads/2010/05/ubuntu-out-of-range.png" alt="Ubuntu Lucid Lynx installer" title="Ubuntu Lucid Lynx installer" width="640" height="480" class="size-full wp-image-97" /></a></p>
<p>That cryptic little keyboard next to that cryptic little man apparently means &#8220;press any key.&#8221;  If you do that, a menu will pop up.  First, select a language, then press <kbd>F6</kbd> (&#8220;Other Options&#8221;).  A new menu will pop up; use the arrow keys to move to &#8220;nomodeset&#8221;, and press <kbd>Enter</kbd> to select it.  Press <kbd>Esc</kbd> to dismiss the menu.  Then you can proceed with the installation as normal.
</li>
<li>
Of course, this only works for the installer.  When you first try to boot your newly installed system, you will get the same error as before.  To boot, you will need to add <code>nomodeset</code> to the kernel command line.  When you boot the machine, wait for the <a href="https://wiki.ubuntu.com/Grub2">GRUB</a> menu to appear.  (If the menu does not appear, you may need to hold down the <kbd>Shift</kbd> key when booting.)</p>
<p><a href="http://blog.siliconforks.com/wp-content/uploads/2010/05/ubuntu-out-of-range-grub.png"><img src="http://blog.siliconforks.com/wp-content/uploads/2010/05/ubuntu-out-of-range-grub.png" alt="GRUB menu" title="GRUB menu" width="640" height="480" class="alignnone size-full wp-image-100" /></a></p>
<p>Press <kbd>e</kbd> to edit the kernel command line:</p>
<p><a href="http://blog.siliconforks.com/wp-content/uploads/2010/05/ubuntu-out-of-range-grub-e.png"><img src="http://blog.siliconforks.com/wp-content/uploads/2010/05/ubuntu-out-of-range-grub-e.png" alt="Editing the kernel command line" title="Editing the kernel command line" width="640" height="480" class="alignnone size-full wp-image-105" /></a></p>
<p>Add <code>nomodeset</code> right after <code>quiet splash</code>:</p>
<p><a href="http://blog.siliconforks.com/wp-content/uploads/2010/05/ubuntu-out-of-range-grub-nomodeset.png"><img src="http://blog.siliconforks.com/wp-content/uploads/2010/05/ubuntu-out-of-range-grub-nomodeset.png" alt="Adding &quot;nomodeset&quot; to the kernel command line" title="Adding &quot;nomodeset&quot; to the kernel command line" width="640" height="480" class="alignnone size-full wp-image-106" /></a></p>
<p>Press <kbd>Ctrl+x</kbd> to boot.
</li>
<li>
Of course, editing the kernel command line only affects the current boot process; the next time you boot the machine, you will have to manually add <code>nomodeset</code> again.  To fix the problem permanently:</p>
<ol>
<li>If you have an NVIDIA video card, installing the proprietary NVIDIA driver may make the problem go away.</li>
<li>Alternatively, you can edit the file <code>/etc/default/grub</code> and change the line
<pre>
GRUB_CMDLINE_LINUX=""
</pre>
<p>to</p>
<pre>
GRUB_CMDLINE_LINUX="nomodeset"
</pre>
<p>Then run</p>
<pre>
sudo update-grub
</pre>
<p>See the <a href="http://www.ubuntu.com/getubuntu/releasenotes/1004#Working%20around%20bugs%20in%20the%20new%20kernel%20video%20architecture">release notes</a> for details.
</li>
</ol>
</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.siliconforks.com/2010/05/07/monitor-out-of-range-installing-ubuntu-lucid-lynx/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using JSCoverage with the JsUnit test suite</title>
		<link>http://blog.siliconforks.com/2010/05/02/jscoverage-jsunit/</link>
		<comments>http://blog.siliconforks.com/2010/05/02/jscoverage-jsunit/#comments</comments>
		<pubDate>Sun, 02 May 2010 21:41:41 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[JSCoverage]]></category>
		<category><![CDATA[JsUnit]]></category>

		<guid isPermaLink="false">http://blog.siliconforks.com/?p=85</guid>
		<description><![CDATA[This is the seventh and final (for now) article in a series on using the JSCoverage tool with various JavaScript testing frameworks: Using JSCoverage with the script.aculo.us test suite Using JSCoverage with the MochiKit test suite Using JSCoverage with the jQuery test suite Using JSCoverage with the MooTools test suite Using JSCoverage with the YUI [...]]]></description>
			<content:encoded><![CDATA[<p>This is the seventh and final (for now) article in a series on using the <a href="http://siliconforks.com/jscoverage/">JSCoverage</a> tool with various JavaScript testing frameworks:</p>
<ol>
<li><a href="http://blog.siliconforks.com/2010/04/26/jscoverage-scriptaculous/">Using JSCoverage with the script.aculo.us test suite</a></li>
<li><a href="http://blog.siliconforks.com/2010/04/27/jscoverage-mochikit/">Using JSCoverage with the MochiKit test suite</a></li>
<li><a href="http://blog.siliconforks.com/2010/04/28/jscoverage-jquery/">Using JSCoverage with the jQuery test suite</a></li>
<li><a href="http://blog.siliconforks.com/2010/04/29/jscoverage-mootools/">Using JSCoverage with the MooTools test suite</a></li>
<li><a href="http://blog.siliconforks.com/2010/04/30/jscoverage-yui/">Using JSCoverage with the YUI test suite</a></li>
<li><a href="http://blog.siliconforks.com/2010/05/01/jscoverage-dojo/">Using JSCoverage with the Dojo test suite</a></li>
<li><a href="http://blog.siliconforks.com/2010/05/02/jscoverage-jsunit/">Using JSCoverage with the JsUnit test suite</a> (this article)</li>
</ol>
<p>Unlike the previous articles in this series, today we will not examine the test suite for an all-purpose JavaScript library, but instead we will look at <a href="http://www.jsunit.net/">JsUnit</a>, dedicated JavaScript test framework.  JsUnit comes with its own test suite, used to test the JsUnit code itself.  To run this test suite, we will download the latest release (version 2.2 as of this writing).  JsUnit is easiest to use running on a web server, so we will install it in the document root of a local <a href="http://httpd.apache.org/">Apache</a> web server, running on port 8080.  Then we can load the following URL in a web browser to run the test suite:</p>
<pre>

http://127.0.0.1:8080/jsunit/testRunner.html?testPage=http://127.0.0.1:8080/jsunit/tests/jsUnitTestSuite.html&#038;autoRun=true
</pre>
<p><a href="http://blog.siliconforks.com/wp-content/uploads/2010/05/jscoverage-jsunit.png"><img src="http://blog.siliconforks.com/wp-content/uploads/2010/05/jscoverage-jsunit-300x225.png" alt="The JsUnit test suite" title="The JsUnit test suite" width="300" height="225" class="alignnone size-medium wp-image-88" /></a></p>
<p>To collect code coverage data for this test suite, we will need to run it in JSCoverage&#8217;s &#8220;inverted mode,&#8221; since it does not run well inside a frame.  This means we will have to add a button to the JsUnit user interface to launch the <code>jscoverage.html</code> file in a separate window.  Looking at the <code>jsunit/app/main-data.html</code> file, we see that the existing buttons are generated dynamically via script; we will generate our button the same way:</p>
<pre>
document.writeln('&lt;input type="button" name="runButton" value="Run" onclick="top.startTests()" class="' + buttonClass + '"&gt;');
document.writeln('&lt;input type="button" name="stopButton" value="Stop" onclick="top.stopTests()" class="' + buttonClass + '"&gt;');
<strong>document.writeln('&lt;input type="button" name="jscoverageButton" value="Coverage Report" onclick="window.open(\'../jscoverage.html\');" class="' + buttonClass + '"&gt;');</strong>
</pre>
<p>Then we can instrument the code using the <code>jscoverage</code> program:</p>
<pre>
jscoverage --no-instrument=tests jsunit instrumented-jsunit
</pre>
<p>We can run the instrumented test suite at the following URL:</p>
<pre>

http://127.0.0.1:8080/instrumented-jsunit/testRunner.html?testPage=http://127.0.0.1:8080/instrumented-jsunit/tests/jsUnitTestSuite.html&#038;autoRun=true
</pre>
<p><a href="http://blog.siliconforks.com/wp-content/uploads/2010/05/jscoverage-jsunit-instrumented.png"><img src="http://blog.siliconforks.com/wp-content/uploads/2010/05/jscoverage-jsunit-instrumented-300x225.png" alt="The JsUnit test suite, instrumented using JSCoverage" title="The JsUnit test suite, instrumented using JSCoverage" width="300" height="225" class="alignnone size-medium wp-image-90" /></a></p>
<p>We can click on the &#8220;Coverage Report&#8221; button to view code coverage statistics:</p>
<p><a href="http://blog.siliconforks.com/wp-content/uploads/2010/05/jscoverage-jsunit-summary.png"><img src="http://blog.siliconforks.com/wp-content/uploads/2010/05/jscoverage-jsunit-summary-300x225.png" alt="The JSCoverage &quot;Summary&quot; tab" title="The JSCoverage &quot;Summary&quot; tab" width="300" height="225" class="alignnone size-medium wp-image-91" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.siliconforks.com/2010/05/02/jscoverage-jsunit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using JSCoverage with the Dojo test suite</title>
		<link>http://blog.siliconforks.com/2010/05/01/jscoverage-dojo/</link>
		<comments>http://blog.siliconforks.com/2010/05/01/jscoverage-dojo/#comments</comments>
		<pubDate>Sat, 01 May 2010 23:14:43 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[Dojo]]></category>
		<category><![CDATA[JSCoverage]]></category>

		<guid isPermaLink="false">http://blog.siliconforks.com/?p=73</guid>
		<description><![CDATA[This is the sixth in a series of articles about using the JSCoverage tool with various JavaScript testing frameworks: Using JSCoverage with the script.aculo.us test suite Using JSCoverage with the MochiKit test suite Using JSCoverage with the jQuery test suite Using JSCoverage with the MooTools test suite Using JSCoverage with the YUI test suite Using [...]]]></description>
			<content:encoded><![CDATA[<p>This is the sixth in a series of articles about using the <a href="http://siliconforks.com/jscoverage/">JSCoverage</a> tool with various JavaScript testing frameworks:</p>
<ol>
<li><a href="http://blog.siliconforks.com/2010/04/26/jscoverage-scriptaculous/">Using JSCoverage with the script.aculo.us test suite</a></li>
<li><a href="http://blog.siliconforks.com/2010/04/27/jscoverage-mochikit/">Using JSCoverage with the MochiKit test suite</a></li>
<li><a href="http://blog.siliconforks.com/2010/04/28/jscoverage-jquery/">Using JSCoverage with the jQuery test suite</a></li>
<li><a href="http://blog.siliconforks.com/2010/04/29/jscoverage-mootools/">Using JSCoverage with the MooTools test suite</a></li>
<li><a href="http://blog.siliconforks.com/2010/04/30/jscoverage-yui/">Using JSCoverage with the YUI test suite</a></li>
<li><a href="http://blog.siliconforks.com/2010/05/01/jscoverage-dojo/">Using JSCoverage with the Dojo test suite</a> (this article)</li>
</ol>
<p>First, we need to <a href="http://dojotoolkit.org/download/">download the Dojo SDK</a>, which includes the Dojo test suite.  The latest release is currently <a href="http://download.dojotoolkit.org/release-1.4.2/dojo-release-1.4.2-src.tar.gz">version 1.4.2</a>.  This release unpacks to a directory named <code>dojo-release-1.4.2-src</code>.  Some of the tests in the test suite need to be run under a web server, so we&#8217;ll install the distribution in the document root of an <a href="http://httpd.apache.org/">Apache</a> web server, running on port 8080.  Then, the test suite, which uses a test framework called <a href="http://www.dojotoolkit.org/reference-guide/quickstart/doh.html">DOH (the Dojo Objective Harness)</a>, can be executed by loading the URL <code>http://127.0.0.1:8080/dojo-release-1.4.2-src/dojo/tests/runTests.html</code> in a web browser:</p>
<p><a href="http://blog.siliconforks.com/wp-content/uploads/2010/05/jscoverage-dojo.png"><img src="http://blog.siliconforks.com/wp-content/uploads/2010/05/jscoverage-dojo-300x225.png" alt="The Dojo test suite" width="300" height="225" class="alignnone size-medium wp-image-75" /></a></p>
<p>To obtain code coverage data for this test suite using JSCoverage, we will need to make one modification to the source code.  The DOH test framework does not work well running inside a frame, so we will use the JSCoverage &#8220;inverted mode&#8221; to run it: we will add a button to the file <code>util/doh/runner.html</code> which launches the JSCoverage user interface:</p>
<pre>
&lt;h3 style="margin: 5px 5px 0px 5px; float: left;"&gt;D.O.H.: The Dojo Objective Harness&lt;/h3&gt;
<strong>&lt;button style="margin-top: 5px; float: left;" onclick="window.open('../../jscoverage.html');"&gt;Coverage Report&lt;/button&gt;</strong>
&lt;img src="small_logo.png" height="40" style="margin: 0px 5px 0px 5px; float: right;"&gt;
</pre>
<p>Then we can run the <code>jscoverage</code> program to instrument the code.  We will use the <code>--no-instrument</code> option avoid instrumenting the test suite itself.  Some of the files in the distribution contain non-ASCII characters encoded using the UTF-8 character encoding, so we will use the <code>--encoding</code> option to specify this.  (Otherwise, we would get &#8220;Illegal character&#8221; errors.)</p>
<pre>
jscoverage --encoding=UTF-8 --no-instrument=dojo/tests dojo-release-1.4.2-src instrumented-dojo
</pre>
<p>Then we can run the instrumented test suite by accessing the URL <code>http://127.0.0.1:8080/instrumented-dojo/dojo/tests/runTests.html</code>:</p>
<p><a href="http://blog.siliconforks.com/wp-content/uploads/2010/05/jscoverage-dojo-instrumented.png"><img src="http://blog.siliconforks.com/wp-content/uploads/2010/05/jscoverage-dojo-instrumented-300x225.png" alt="The Dojo test suite, instrumented using JSCoverage" width="300" height="225" class="alignnone size-medium wp-image-76" /></a></p>
<p>Note that some tests failed (indicated by the red sections in the bar at the top).  Looking at the DOH &#8220;Log&#8221; tab, we see a lot of errors like this:</p>
<pre>
Error: Bundle not found: currency in dojo.cldr , locale=en-us
</pre>
<p>Looking in the (uninstrumented) <code>dojo/cldr</code> directory, we see it contains a lot of <code>.js</code> files; <code>dojo/cldr/nls/en-us/currency.js</code> is typical:</p>
<pre>
// generated from ldml/main/*.xml, xpath: ldml/numbers/currencies
({
        USD_symbol:"$"
})
</pre>
<p>The <code>.js</code> files under the <code>dojo/cldr/nls</code> directory contain <em>valid</em> JavaScript code, but they do not contain <em>arbitrary</em> JavaScript code; Dojo expects every one of these files to contain a single JavaScript object literal.  When <code>jscoverage</code> adds instrumentation to one of these files, it no longer contains a single JavaScript object literal, and this causes errors when the test suite is run.  We need to use the <code>--no-instrument</code> option to ensure that these files are not instrumented:</p>
<pre>
jscoverage --encoding=UTF-8 --no-instrument=dojo/tests --no-instrument=dojo/cldr/nls dojo-release-1.4.2-src instrumented-dojo
</pre>
<p>Then we can run the instrumented tests without any errors:</p>
<p><a href="http://blog.siliconforks.com/wp-content/uploads/2010/05/jscoverage-dojo-instrumented-success.png"><img src="http://blog.siliconforks.com/wp-content/uploads/2010/05/jscoverage-dojo-instrumented-success-300x225.png" alt="The Dojo test suite, instrumented using JSCoverage" width="300" height="225" class="alignnone size-medium wp-image-78" /></a></p>
<p>We can click on the &#8220;Coverage Report&#8221; button to see the code coverage statistics:</p>
<p><a href="http://blog.siliconforks.com/wp-content/uploads/2010/05/jscoverage-dojo-instrumented-report.png"><img src="http://blog.siliconforks.com/wp-content/uploads/2010/05/jscoverage-dojo-instrumented-report-300x225.png" alt="The JSCoverage &quot;Summary&quot; tab" width="300" height="225" class="alignnone size-medium wp-image-79" /></a></p>
<p>Tomorrow we will look at using JSCoverage with the <a href="http://www.jsunit.net/">JsUnit</a> test framework.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.siliconforks.com/2010/05/01/jscoverage-dojo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using JSCoverage with the YUI test suite</title>
		<link>http://blog.siliconforks.com/2010/04/30/jscoverage-yui/</link>
		<comments>http://blog.siliconforks.com/2010/04/30/jscoverage-yui/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 18:12:32 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[JSCoverage]]></category>
		<category><![CDATA[YUI]]></category>

		<guid isPermaLink="false">http://blog.siliconforks.com/?p=54</guid>
		<description><![CDATA[This is the fifth in a series of articles about using the JSCoverage tool with various JavaScript testing frameworks: Using JSCoverage with the script.aculo.us test suite Using JSCoverage with the MochiKit test suite Using JSCoverage with the jQuery test suite Using JSCoverage with the MooTools test suite Using JSCoverage with the YUI test suite (this [...]]]></description>
			<content:encoded><![CDATA[<p>This is the fifth in a series of articles about using the JSCoverage tool with various JavaScript testing frameworks:</p>
<ol>
<li><a href="http://blog.siliconforks.com/2010/04/26/jscoverage-scriptaculous/">Using JSCoverage with the script.aculo.us test suite</a></li>
<li><a href="http://blog.siliconforks.com/2010/04/27/jscoverage-mochikit/">Using JSCoverage with the MochiKit test suite</a></li>
<li><a href="http://blog.siliconforks.com/2010/04/28/jscoverage-jquery/">Using JSCoverage with the jQuery test suite</a></li>
<li><a href="http://blog.siliconforks.com/2010/04/29/jscoverage-mootools/">Using JSCoverage with the MooTools test suite</a></li>
<li><a href="http://blog.siliconforks.com/2010/04/30/jscoverage-yui/">Using JSCoverage with the YUI test suite</a> (this article)</li>
</ol>
<p>First, we need to download <a href="http://developer.yahoo.com/yui/">YUI</a>.  We will use the latest release in the YUI 2 series, version 2.8.0r4.  The YUI test suite requires a web server to run in some browsers, so we will install it in the document root of a local <a href="http://httpd.apache.org/">Apache</a> server, running on port 8080.  Also, the file <code>yui/tests/common/tests/YUI.html</code> has a typo that needs to be corrected; we need to change this:</p>
<pre>
           "../../calendar/tests/datemath.html",
</pre>
<p>to this:</p>
<pre>
           "../../datemath/tests/datemath.html",
</pre>
<p>Once that is done, we just open the URL <code>http://127.0.0.1:8080/yui/tests/common/tests/YUI.html</code> in a web browser to run the tests:</p>
<p><a href="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-yui.png"><img src="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-yui-300x225.png" alt="The YUI test suite" title="The YUI test suite" width="300" height="225" class="alignnone size-medium wp-image-56" /></a></p>
<p>To obtain code coverage data, we will have to make one more modification to the file <code>yui/tests/common/tests/YUI.html</code>.  The YUI test framework does not work inside a frame, so we will use JSCoverage &#8220;inverted mode&#8221; to run the tests.  This entails adding a button to the page to launch the <code>jscoverage.html</code> file:</p>
<pre>
&lt;div id="out"&gt;&lt;/div&gt;
<strong>&lt;button onclick="window.open('../../../jscoverage.html');"&gt;Coverage report&lt;/button&gt;</strong>
</pre>
<p>Once that addition is made, we can instrument the code:</p>
<pre>
jscoverage --no-instrument=tests yui instrumented-yui
</pre>
<p>Note that the YUI distribution is fairly large, so this command may take a while to run.  We can speed things up a bit by using the <code>--exclude</code> option to skip some directories that are not needed:</p>
<pre>
jscoverage --no-instrument=tests --exclude=as-docs --exclude=docs --exclude=examples yui instrumented-yui
</pre>
<p>Then we open up the URL <code>http://127.0.0.1:8080/instrumented-yui/tests/common/tests/YUI.html</code> in our web browser:</p>
<p><a href="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-yui-inverted.png"><img src="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-yui-inverted-300x225.png" alt="The instrumented YUI test suite, with &quot;Coverage report&quot; button" title="The instrumented YUI test suite, with &quot;Coverage report&quot; button" width="300" height="225" class="alignnone size-medium wp-image-57" /></a></p>
<p>We can then click the &#8220;Coverage report&#8221; button to launch the <code>jscoverage.html</code> file:</p>
<p><a href="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-yui-summary.png"><img src="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-yui-summary-300x225.png" alt="The JSCoverage &quot;Summary&quot; tab" title="The JSCoverage &quot;Summary&quot; tab" width="300" height="225" class="alignnone size-medium wp-image-58" /></a></p>
<p>Tomorrow we will look at using JSCoverage with the <a href="http://dojotoolkit.org/">Dojo</a> test suite.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.siliconforks.com/2010/04/30/jscoverage-yui/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using JSCoverage with the MooTools test suite</title>
		<link>http://blog.siliconforks.com/2010/04/29/jscoverage-mootools/</link>
		<comments>http://blog.siliconforks.com/2010/04/29/jscoverage-mootools/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 20:15:34 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[JSCoverage]]></category>
		<category><![CDATA[MooTools]]></category>

		<guid isPermaLink="false">http://blog.siliconforks.com/?p=46</guid>
		<description><![CDATA[This is the fourth in a series of articles about using the JSCoverage tool with various JavaScript testing frameworks: Using JSCoverage with the script.aculo.us test suite Using JSCoverage with the MochiKit test suite Using JSCoverage with the jQuery test suite Using JSCoverage with the MooTools test suite (this article) First, we need to check out [...]]]></description>
			<content:encoded><![CDATA[<p>This is the fourth in a series of articles about using the JSCoverage tool with various JavaScript testing frameworks:</p>
<ol>
<li><a href="http://blog.siliconforks.com/2010/04/26/jscoverage-scriptaculous/">Using JSCoverage with the script.aculo.us test suite</a></li>
<li><a href="http://blog.siliconforks.com/2010/04/27/jscoverage-mochikit/">Using JSCoverage with the MochiKit test suite</a></li>
<li><a href="http://blog.siliconforks.com/2010/04/28/jscoverage-jquery/">Using JSCoverage with the jQuery test suite</a></li>
<li><a href="http://blog.siliconforks.com/2010/04/29/jscoverage-mootools/">Using JSCoverage with the MooTools test suite</a> (this article)</li>
</ol>
<p>First, we need to check out <a href="http://mootools.net/">MooTools</a> from its <a href="http://github.com/mootools/mootools-core">Git repository</a>.  We will check this out into the <code>F:\</code> directory.  The repository contains a <code>.gitmodules</code> file referencing Git submodules; we will need those too:</p>
<pre>
git clone http://github.com/mootools/mootools-core.git
cd mootools-core
git submodule init
git submodule update
</pre>
<p>MooTools actually has two test suites: one in the <code>Specs</code> directory and one in the <code>Tests</code> directory.  The one in <code>Tests</code> is newer and does not have very many tests in it yet, so we will skip that one and just run the one in the <code>Specs</code> directory.  To run the test suite, we open the URL <code>file:///F:/mootools-core/Specs/index.html</code> in a web browser:</p>
<p><a href="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-mootools.png"><img src="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-mootools-300x225.png" alt="The MooTools test suite" title="The MooTools test suite" width="300" height="225" class="alignnone size-medium wp-image-49" /></a></p>
<p>It lists a number of test suites; we will choose to run &#8220;MooTools-Core 1.3: 1.2public + 1.3public&#8221;.  Clicking on the link loads the URL <code>file:///F:/mootools-core/Specs/runner1.3.html?specs=1.2public&amp;specs=1.3public</code>:</p>
<p><a href="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-mootools-uninstrumented.png"><img src="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-mootools-uninstrumented-300x225.png" alt="The MooTools test suite" title="The MooTools test suite" width="300" height="225" class="alignnone size-medium wp-image-50" /></a></p>
<p>We will instrument this code using the <code>jscoverage</code> tool.  We will use the <code>--exclude</code> option to skip the <code>Tests</code> directory and the <code>--no-instrument</code> option to avoid instrumenting the test suite in the <code>Specs</code> directory:</p>
<pre>
jscoverage --exclude=Tests --no-instrument=Specs mootools-core instrumented-mootools
</pre>
<p>To run the instrumented tests, usually we open in our web browser a URL of the form <code>file:///.../jscoverage.html?<var>URL</var></code>, where <var>URL</var> is the URL of the test suite.  But note that the test suite URL contains some special characters, so we need to encode these when putting them in a URL:</p>
<pre>file:///F:/instrumented-mootools/jscoverage.html?Specs%2Frunner1.3.html%3Fspecs%3D1.2public%26specs%3D1.3public</pre>
<p>We can open this in our web browser:</p>
<p><a href="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-mootools-browser.png"><img src="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-mootools-browser-300x225.png" alt="The MooTools test suite, instrumented using JSCoverage" title="The MooTools test suite, instrumented using JSCoverage" width="300" height="225" class="alignnone size-medium wp-image-51" /></a></p>
<p>The &#8220;Summary&#8221; tab displays coverage statistics:</p>
<p><a href="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-mootools-summary.png"><img src="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-mootools-summary-300x225.png" alt="The JSCoverage &quot;Summary&quot; tab" title="The JSCoverage &quot;Summary&quot; tab" width="300" height="225" class="alignnone size-medium wp-image-52" /></a></p>
<p>Tomorrow we will look at using JSCoverage with the <a href="http://developer.yahoo.com/yui/">YUI</a> test suite.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.siliconforks.com/2010/04/29/jscoverage-mootools/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using JSCoverage with the jQuery test suite</title>
		<link>http://blog.siliconforks.com/2010/04/28/jscoverage-jquery/</link>
		<comments>http://blog.siliconforks.com/2010/04/28/jscoverage-jquery/#comments</comments>
		<pubDate>Wed, 28 Apr 2010 18:05:28 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[JSCoverage]]></category>

		<guid isPermaLink="false">http://blog.siliconforks.com/?p=35</guid>
		<description><![CDATA[This is the third in a series of articles about using the JSCoverage tool with various JavaScript testing frameworks: Using JSCoverage with the script.aculo.us test suite Using JSCoverage with the MochiKit test suite Using JSCoverage with the jQuery test suite (this article) To run the jQuery test suite, we need to check out the jQuery [...]]]></description>
			<content:encoded><![CDATA[<p>This is the third in a series of articles about using the JSCoverage tool with various JavaScript testing frameworks:</p>
<ol>
<li><a href="http://blog.siliconforks.com/2010/04/26/jscoverage-scriptaculous/">Using JSCoverage with the script.aculo.us test suite</a></li>
<li><a href="http://blog.siliconforks.com/2010/04/27/jscoverage-mochikit/">Using JSCoverage with the MochiKit test suite</a></li>
<li><a href="http://blog.siliconforks.com/2010/04/28/jscoverage-jquery/">Using JSCoverage with the jQuery test suite</a> (this article)</li>
</ol>
<p>To run the jQuery test suite, we need to check out the <a href="http://docs.jquery.com/Downloading_jQuery#Git">jQuery Git repository</a>.  We will use <a href="http://cygwin.com/">Cygwin</a> Git and check out the code into the <code>F:\</code> directory:</p>
<pre>
cd /cygdrive/f
git clone git://github.com/jquery/jquery.git
make
</pre>
<p>The <code>make</code> command retrieves some external dependencies (one of which is <a href="http://docs.jquery.com/QUnit">QUnit</a>, the framework used in the test suite) and builds the <code>jquery.js</code> file.  To run the test suite, we just open the file <code>test/index.html</code> in a web browser:</p>
<p><a href="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-jquery.png"><img src="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-jquery-300x225.png" alt="The jQuery test suite" title="The jQuery test suite" width="300" height="225" class="alignnone size-medium wp-image-40" /></a></p>
<p>We will instrument the code using the <code>jscoverage</code> program, using the <code>--no-instrument</code> option to avoid instrumenting the test suite directory itself (as we did for the <a href="http://blog.siliconforks.com/2010/04/27/jscoverage-mochikit/">MochiKit test suite</a>):</p>
<pre>
jscoverage --no-instrument=test F:\jquery F:\instrumented-jquery
</pre>
<p>Unfortunately, things do not go smoothly; we get the following output:</p>
<pre>
jscoverage:src/intro.js:18: SyntaxError: missing } after function body
jscoverage: parse error in file src/intro.js
</pre>
<p>The contents of the file <code>F:\jquery\src\intro.js</code> are as follows:</p>
<pre>
/*!
 * jQuery JavaScript Library v@VERSION
 * http://jquery.com/
 *
 * Copyright 2010, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 * Copyright 2010, The Dojo Foundation
 * Released under the MIT, BSD, and GPL Licenses.
 *
 * Date:
 */
(function( window, undefined ) {
</pre>
<p>That is the entire file.  The file is not actually a valid JavaScript file by itself (which is why <code>jscoverage</code> was confused by it) but is used as input to the build process used to construct the final <code>jquery.js</code> file.  Since this is needed only for building the code, not for running it, we can skip it entirely when instrumenting the code.  We tell <code>jscoverage</code> to do this using the <code>--exclude</code> option:</p>
<pre>
jscoverage --no-instrument=test --exclude=src/intro.js F:\jquery F:\instrumented-jquery
</pre>
<p>Running this command, the previous error is gone, but we get a new error:</p>
<pre>
jscoverage:src/outro.js:1: SyntaxError: syntax error
jscoverage: parse error in file src/outro.js
</pre>
<p>Looking at <code>F:\jquery\src\outro.js</code>, we see again this is just a fragment of a JavaScript file, not a valid JavaScript file by itself:</p>
<pre>
})(window);
</pre>
<p>We will add another <code>--exclude</code> option for this file.  (Note that the <code>--exclude</code> option can be used multiple times.)</p>
<pre>
jscoverage --no-instrument=test --exclude=src/intro.js --exclude=src/outro.js F:\jquery F:\instrumented-jquery
</pre>
<p>Finally, the command runs without any errors.  We can run the instrumented test suite by opening the URL <code>file:///F:/instrumented-jquery/jscoverage.html?test/index.html</code> in our web browser:</p>
<p><a href="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-jquery-browser.png"><img src="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-jquery-browser-300x225.png" alt="The jQuery test suite, instrumented using JSCoverage" title="The jQuery test suite, instrumented using JSCoverage" width="300" height="225" class="alignnone size-medium wp-image-41" /></a></p>
<p>Tomorrow, we will look at using JSCoverage with the <a href="http://mootools.net/">MooTools</a> test suite.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.siliconforks.com/2010/04/28/jscoverage-jquery/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using JSCoverage with the MochiKit test suite</title>
		<link>http://blog.siliconforks.com/2010/04/27/jscoverage-mochikit/</link>
		<comments>http://blog.siliconforks.com/2010/04/27/jscoverage-mochikit/#comments</comments>
		<pubDate>Tue, 27 Apr 2010 16:45:47 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[JSCoverage]]></category>
		<category><![CDATA[MochiKit]]></category>

		<guid isPermaLink="false">http://blog.siliconforks.com/?p=23</guid>
		<description><![CDATA[This is the second in a series of articles about using the JSCoverage tool with various JavaScript testing frameworks. Yesterday we discussed using JSCoverage with the script.aculo.us test suite; today we will cover (no pun intended) the MochiKit test suite. To run the test suite, first we have to download the latest version of MochiKit [...]]]></description>
			<content:encoded><![CDATA[<p>This is the second in a series of articles about using the <a href="http://siliconforks.com/jscoverage/">JSCoverage</a> tool with various JavaScript testing frameworks.  <a href="http://blog.siliconforks.com/2010/04/26/jscoverage-scriptaculous/">Yesterday we discussed</a> using JSCoverage with the <a href="http://script.aculo.us/">script.aculo.us</a> test suite; today we will cover (no pun intended) the <a href="http://mochikit.com/">MochiKit</a> test suite.</p>
<p>To run the test suite, first we have to download the latest version of MochiKit (currently <a href="http://mochikit.com/dist/MochiKit-1.4.2.zip">version 1.4.2</a>).  We will assume this distribution is unpacked in the <code>F:\</code> root directory, creating the directory <code>F:\MochiKit-1.4.2</code>. Then we can open the URL <code>file:///F:/MochiKit-1.4.2/tests/index.html</code> in a web browser:</p>
<p><a href="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-mochikit1.png"><img src="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-mochikit1-300x225.png" alt="The MochiKit test suite" title="The MochiKit test suite" width="300" height="225" class="alignnone size-medium wp-image-33" /></a></p>
<p>To get code coverage for this test suite, we first instrument the code using the <code>jscoverage</code> program:</p>
<pre>
jscoverage F:\MochiKit-1.4.2 F:\instrumented-mochikit
</pre>
<p>Then we open the URL <code>file:///F:/instrumented-mochikit/jscoverage.html?tests/index.html</code> in our web browser:</p>
<p><a href="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-mochikit-browser.png"><img src="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-mochikit-browser-300x225.png" alt="The MochiKit test suite, instrumented using JSCoverage" title="The MochiKit test suite, instrumented using JSCoverage" width="300" height="225" class="alignnone size-medium wp-image-26" /></a></p>
<p>The code coverage statistics are displayed in the &#8220;Summary&#8221; tab:</p>
<p><a href="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-mochikit-summary.png"><img src="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-mochikit-summary-300x225.png" alt="The JSCoverage &quot;Summary&quot; tab" title="The JSCoverage &quot;Summary&quot; tab" width="300" height="225" class="alignnone size-medium wp-image-28" /></a></p>
<p>That works, but there is one improvement we can make.  Notice that the list of files in the &#8220;Summary&#8221; tab contains both the files in the <a href="http://xunitpatterns.com/SUT.html"><acronym title="System Under Test">SUT</acronym></a> (in the <code>lib</code> directory) and the files in the test suite itself (in the <code>tests</code> directory).  We are not really interested in coverage statistics for the latter; we can tell the <code>jscoverage</code> program to avoid instrumenting these files by running it with the <code>--no-instrument</code> option:</p>
<pre>
jscoverage --no-instrument=tests F:\MochiKit-1.4.2 F:\instrumented-mochikit
</pre>
<p>With that command, <code>jscoverage</code> will not instrument any JavaScript files in the <code>tests</code> directory.  We can run the test suite again in our web browser and see that the files in the <code>tests</code> directory are no longer displayed:</p>
<p><a href="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-mochikit-no-instrument.png"><img src="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-mochikit-no-instrument-300x225.png" alt="The JSCoverage &quot;Summary&quot; tab (after using --no-instrument)" title="The JSCoverage &quot;Summary&quot; tab (after using --no-instrument)" width="300" height="225" class="alignnone size-medium wp-image-27" /></a></p>
<p>Tomorrow, we will look at using JSCoverage with the <a href="http://jquery.com/">jQuery</a> test suite.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.siliconforks.com/2010/04/27/jscoverage-mochikit/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using JSCoverage with the script.aculo.us test suite</title>
		<link>http://blog.siliconforks.com/2010/04/26/jscoverage-scriptaculous/</link>
		<comments>http://blog.siliconforks.com/2010/04/26/jscoverage-scriptaculous/#comments</comments>
		<pubDate>Mon, 26 Apr 2010 14:48:40 +0000</pubDate>
		<dc:creator>Ed</dc:creator>
				<category><![CDATA[JSCoverage]]></category>
		<category><![CDATA[script.aculo.us]]></category>

		<guid isPermaLink="false">http://blog.siliconforks.com/?p=5</guid>
		<description><![CDATA[This is the first in a series of articles about using the JSCoverage tool with various JavaScript testing frameworks. Today, we will look at using JSCoverage with the script.aculo.us test suite. We will start by downloading the latest version of script.aculo.us (currently version 1.8.3) and unpacking the distribution in the F:\ directory (so that the [...]]]></description>
			<content:encoded><![CDATA[<p>This is the first in a series of articles about using the <a href="http://siliconforks.com/jscoverage/">JSCoverage</a> tool with various JavaScript testing frameworks.  Today, we will look at using JSCoverage with the <a href="http://script.aculo.us/">script.aculo.us</a> test suite.</p>
<p>
We will start by downloading the latest version of script.aculo.us (currently <a href="http://script.aculo.us/dist/scriptaculous-js-1.8.3.tar.bz2">version 1.8.3</a>) and unpacking the distribution in the <code>F:\</code> directory (so that the code unpacks to the directory <code>F:\scriptaculous-js-1.8.3</code>).  Running the test suite is simple: all we have to do is open the file <code>test/run_unit_tests.html</code> in a web browser.  Because we unpacked the script.aculo.us distribution in the <code>F:\</code> directory, the URL would be</p>
<pre>file:///F:/scriptaculous-js-1.8.3/test/run_unit_tests.html
</pre>
<p>The user interface displays two frames; clicking one of the links in the left frame runs a test in the right frame.</p>
<p>
<a href="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-scriptaculous.png"><img src="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-scriptaculous-300x225.png" alt="The script.aculo.us test suite" title="The script.aculo.us test suite" width="300" height="225" class="alignnone size-medium wp-image-13" /></a></p>
<p>
To get code coverage for this test suite, we need to instrument the code using <code>jscoverage</code>.</p>
<pre>
jscoverage F:\scriptaculous-js-1.8.3 F:\instrumented-scriptaculous
</pre>
<p>This creates a new directory, <code>instrumented-scriptaculous</code>, which is a copy of the original directory with two differences:</p>
<ol>
<li>All of the <code>.js</code> files in the directory have been <a href="http://en.wikipedia.org/wiki/Instrumentation_%28computer_programming%29">instrumented</a> to collect code coverage data when executed.</li>
<li>The directory contains a file <code>jscoverage.html</code> (and a few other support files) for displaying code coverage data.
</ol>
<p>We need to open the <code>jscoverage.html</code> file in our web browser, and pass the path to the test suite in the query string:</p>
<pre>file:///F:/instrumented-scriptaculous/jscoverage.html?test/run_unit_tests.html
</pre>
<p>The <code>run_unit_tests.html</code> is displayed in an iframe; in that frame we can execute the tests as we did before.</p>
<p>
<a href="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-scriptaculous-browser.png"><img src="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-scriptaculous-browser-300x225.png" alt="The script.aculo.us test suite, instrumented using JSCoverage" title="The script.aculo.us test suite, instrumented using JSCoverage" width="300" height="225" class="alignnone size-medium wp-image-15" /></a></p>
<p>
After running some tests, we can click on the &#8220;Summary&#8221; tab to display code coverage statistics:</p>
<p>
<a href="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-scriptaculous-summary.png"><img src="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-scriptaculous-summary-300x225.png" alt="The JSCoverage &quot;Summary&quot; tab" title="The JSCoverage &quot;Summary&quot; tab" width="300" height="225" class="alignnone size-medium wp-image-16" /></a></p>
<p>
We can click one of the links to get a detailed view of a source file:</p>
<p>
<a href="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-scriptaculous-source.png"><img src="http://blog.siliconforks.com/wp-content/uploads/2010/04/jscoverage-scriptaculous-source-300x225.png" alt="The JSCoverage &quot;Source&quot; tab" title="The JSCoverage &quot;Source&quot; tab" width="300" height="225" class="alignnone size-medium wp-image-17" /></a></p>
<p>
Tomorrow, we will look at using JSCoverage with the <a href="http://mochikit.com">MochiKit</a> test suite.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.siliconforks.com/2010/04/26/jscoverage-scriptaculous/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

