<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Rails Forum - Ruby on Rails Help and Discussion Forum - Adding views to rake stats or rcov test coverage...]]></title>
		<link>http://railsforum.com/viewtopic.php?id=157</link>
		<description><![CDATA[The most recent posts in Adding views to rake stats or rcov test coverage....]]></description>
		<lastBuildDate>Sat, 08 Jul 2006 21:23:17 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Adding views to rake stats or rcov test coverage...]]></title>
			<link>http://railsforum.com/viewtopic.php?pid=884#p884</link>
			<description><![CDATA[<p>Has anyone tried adding the code in app/views/ to the files that get included in rake stats or in rake test:rcov?</p><p>I tried digging into the rake stats task to figure out how to add files and the *.rb regexp is buried rather deeply in the code without a good way to provide an alternate regexp for a directory without just hard-coding it in the code.&nbsp; I haven&#039;t dug too deep into rcov yet to see how it handles it.</p><p>Its not a big deal for stats, so if I can&#039;t get it, its no big deal.&nbsp; It would be nice to have an easy way to audit which templates don&#039;t have view test cases though, and I was hoping to piggyback on rcov for that.&nbsp; (Given that most views are relatively conditional free they will probably end up being either 0% or 100% covered)</p><p>For stats, its slightly annoying that view tests artificially inflate the Test:Code ratio (as the tested &quot;code&quot; isn&#039;t included in to LOC count.&nbsp; I expect code:test to stabilize close to 1:1.&nbsp; I know many people report values closer to 1:4 with Rails, but I think that&#039;s primarily due to the fact that the stock assertions are slightly &quot;underpowered&quot; and that some of the rails conventions tutorials don&#039;t demonstrate refactoring test code very effectively.</p><p>In my two (still small projects), i&#039;ve been tracking about 1:1.4 for model code and 1:2 for controller code (1:3 if view tests are included in test code for controller).&nbsp; If I break out view LOC (for now counting both constant html and eRb), the ratio is about 1:0.3 for view code.&nbsp; (Which actually seems about right -- I want to have tests that assert the &quot;functional interface&quot; while leaving some of the design related page structure flexible.</p><p>Now of course code:test ratios don&#039;t really mean anything.&nbsp; However I do think its worth looking at places where, repeatedly the amount of test code dwarfs the application code -- this is a sign that the testing language isn&#039;t as high level as the application language and thus ripe for custom assertions, etc</p><p>And f course I&#039;m very torn as to what a LOC <strong>is</strong> in a template file....&nbsp; any line with embedded Ruby?&nbsp; any non whitespace?, etc</p>]]></description>
			<author><![CDATA[dummy@example.com (NielsenE)]]></author>
			<pubDate>Sat, 08 Jul 2006 21:23:17 +0000</pubDate>
			<guid>http://railsforum.com/viewtopic.php?pid=884#p884</guid>
		</item>
	</channel>
</rss>
