<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Oracle PL/SQL unit testing with Ruby</title>
	<atom:link href="http://blog.rayapps.com/2009/11/27/oracle-plsql-unit-testing-with-ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.rayapps.com/2009/11/27/oracle-plsql-unit-testing-with-ruby/</link>
	<description>About Ruby, Oracle, Mac and others</description>
	<lastBuildDate>Mon, 08 Mar 2010 20:50:38 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Douwe Vonk</title>
		<link>http://blog.rayapps.com/2009/11/27/oracle-plsql-unit-testing-with-ruby/#comment-1134</link>
		<dc:creator>Douwe Vonk</dc:creator>
		<pubDate>Wed, 03 Mar 2010 20:11:53 +0000</pubDate>
		<guid isPermaLink="false">http://rayapps.wordpress.com/?p=124#comment-1134</guid>
		<description>Cool stuff, I am using Oracle (and am a big fan of Ruby) and will definitely try this out. I have already one or two smaller but critical procedures in mind for this. Thanks for sharing this!</description>
		<content:encoded><![CDATA[<p>Cool stuff, I am using Oracle (and am a big fan of Ruby) and will definitely try this out. I have already one or two smaller but critical procedures in mind for this. Thanks for sharing this!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Raimonds Simanovskis</title>
		<link>http://blog.rayapps.com/2009/11/27/oracle-plsql-unit-testing-with-ruby/#comment-1046</link>
		<dc:creator>Raimonds Simanovskis</dc:creator>
		<pubDate>Fri, 11 Dec 2009 13:27:16 +0000</pubDate>
		<guid isPermaLink="false">http://rayapps.wordpress.com/?p=124#comment-1046</guid>
		<description>I recommend to start with &lt;a href=&quot;http://www.ruby-lang.org/en/documentation/quickstart/&quot; rel=&quot;nofollow&quot;&gt;Ruby in Twenty Minutes&lt;/a&gt; tutorial. Then you can take a look on some &lt;a href=&quot;http://rspec.info/documentation/&quot; rel=&quot;nofollow&quot;&gt;RSpec examples&lt;/a&gt; how to write and structure tests. And then you can take a look at &lt;a href=&quot;http://github.com/rsim/ruby-plsql/blob/master/spec/plsql/procedure_spec.rb&quot; rel=&quot;nofollow&quot;&gt;ruby-plsql&lt;/a&gt; own tests to see how to pass parameters and verify results for different PL/SQL data types.

I will put these links and some additional guidelines in &lt;a href=&quot;http://github.com/rsim/ruby-plsql-spec&quot; rel=&quot;nofollow&quot;&gt;ruby-plsql-spec README&lt;/a&gt; as it seems it will be valuable for many PL/SQL developers who would like to try this out.</description>
		<content:encoded><![CDATA[<p>I recommend to start with <a href="http://www.ruby-lang.org/en/documentation/quickstart/" rel="nofollow">Ruby in Twenty Minutes</a> tutorial. Then you can take a look on some <a href="http://rspec.info/documentation/" rel="nofollow">RSpec examples</a> how to write and structure tests. And then you can take a look at <a href="http://github.com/rsim/ruby-plsql/blob/master/spec/plsql/procedure_spec.rb" rel="nofollow">ruby-plsql</a> own tests to see how to pass parameters and verify results for different PL/SQL data types.</p>
<p>I will put these links and some additional guidelines in <a href="http://github.com/rsim/ruby-plsql-spec" rel="nofollow">ruby-plsql-spec README</a> as it seems it will be valuable for many PL/SQL developers who would like to try this out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tobias</title>
		<link>http://blog.rayapps.com/2009/11/27/oracle-plsql-unit-testing-with-ruby/#comment-1045</link>
		<dc:creator>tobias</dc:creator>
		<pubDate>Fri, 11 Dec 2009 07:36:34 +0000</pubDate>
		<guid isPermaLink="false">http://rayapps.wordpress.com/?p=124#comment-1045</guid>
		<description>The criteria for &quot;good&quot; unit tests above resonates with me. I would like to look into unit testing using ruby-plsql. However, I have no background in Ruby programming. Could you please share some tips on how to adopt this approach quickly?</description>
		<content:encoded><![CDATA[<p>The criteria for &#8220;good&#8221; unit tests above resonates with me. I would like to look into unit testing using ruby-plsql. However, I have no background in Ruby programming. Could you please share some tips on how to adopt this approach quickly?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jva</title>
		<link>http://blog.rayapps.com/2009/11/27/oracle-plsql-unit-testing-with-ruby/#comment-1022</link>
		<dc:creator>jva</dc:creator>
		<pubDate>Mon, 30 Nov 2009 10:39:46 +0000</pubDate>
		<guid isPermaLink="false">http://rayapps.wordpress.com/?p=124#comment-1022</guid>
		<description>Also, can we get an article on how to refactor existing PL/SQL code to unit-testable PL/SQL code without severe performance penalty (that means no slow-by-slow http://tkyte.blogspot.com/2006/10/slow-by-slow.html)?

procedure process_customers_123 (bookkeeping_period in date)
is
begin
open cursor customers;
loop
fetch bulk collect into r_customers limit 1000;
exit when no_data_found;
forall i in 1..r_customers.count update customers set case when.., case when.., case when..;
forall i in 1..r_customers.count insert into other_table1 values ...;
forall i in 1..r_customers.count update other_table2 set case when.., decode(), case when...;
-- and so on
end loop;

end;</description>
		<content:encoded><![CDATA[<p>Also, can we get an article on how to refactor existing PL/SQL code to unit-testable PL/SQL code without severe performance penalty (that means no slow-by-slow <a href="http://tkyte.blogspot.com/2006/10/slow-by-slow.html)?" rel="nofollow">http://tkyte.blogspot.com/2006/10/slow-by-slow.html)?</a></p>
<p>procedure process_customers_123 (bookkeeping_period in date)<br />
is<br />
begin<br />
open cursor customers;<br />
loop<br />
fetch bulk collect into r_customers limit 1000;<br />
exit when no_data_found;<br />
forall i in 1..r_customers.count update customers set case when.., case when.., case when..;<br />
forall i in 1..r_customers.count insert into other_table1 values &#8230;;<br />
forall i in 1..r_customers.count update other_table2 set case when.., decode(), case when&#8230;;<br />
&#8211; and so on<br />
end loop;</p>
<p>end;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jva</title>
		<link>http://blog.rayapps.com/2009/11/27/oracle-plsql-unit-testing-with-ruby/#comment-1021</link>
		<dc:creator>jva</dc:creator>
		<pubDate>Mon, 30 Nov 2009 10:23:08 +0000</pubDate>
		<guid isPermaLink="false">http://rayapps.wordpress.com/?p=124#comment-1021</guid>
		<description>These smaller units then should be treated as private procedures and should not be accessible from outside the package, so it will not be unit-testable anyway. Or do we trade one bad practice for another?</description>
		<content:encoded><![CDATA[<p>These smaller units then should be treated as private procedures and should not be accessible from outside the package, so it will not be unit-testable anyway. Or do we trade one bad practice for another?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Raimonds Simanovskis</title>
		<link>http://blog.rayapps.com/2009/11/27/oracle-plsql-unit-testing-with-ruby/#comment-1019</link>
		<dc:creator>Raimonds Simanovskis</dc:creator>
		<pubDate>Fri, 27 Nov 2009 16:28:50 +0000</pubDate>
		<guid isPermaLink="false">http://rayapps.wordpress.com/?p=124#comment-1019</guid>
		<description>Non-trivial code should be split into smaller units which could be unit tested separately. It will be very hard to maintain one unit which updates 400+ fields. And if one program unit updates any number of other tables then probably it is also not a good design and is hard to maintain.

Good unit test should include both input data and results and should leave test database in the state as it was before test. Therefore it is better to keep test data generation inside unit test and not somewhere else - it helps both for readability for test (you see all inputs in test) as well as maintainability (if related things are stored in different places then it is harder to notice what else should be changed).

And I also recommend to separate unit tests (where you validate logic on specific small examples and test all different edge cases) from performance / integration tests where you test just some basic scenarios on large data volumes.

And last comment about &quot;PL/SQL developer&quot;. If the only tool you have is hammer then all problems seem to be nails :) Good software developer should have several tools and apply the right tool for the right problem. If PL/SQL is not a good language for testing (which could be seen from failure of utPLSQL project) then good developers should look for better tools for the job. And dynamic languages like Ruby or Python are better for such task. And you shouldn&#039;t be an expert Ruby programmer to use this approach - the amount of learning of described framework probably is similar to learning GUI testing frameworks like Quest Code Tester or SQL Developer unit testing. And I am eager to help with advice and suggestions how to learn this approach faster :)</description>
		<content:encoded><![CDATA[<p>Non-trivial code should be split into smaller units which could be unit tested separately. It will be very hard to maintain one unit which updates 400+ fields. And if one program unit updates any number of other tables then probably it is also not a good design and is hard to maintain.</p>
<p>Good unit test should include both input data and results and should leave test database in the state as it was before test. Therefore it is better to keep test data generation inside unit test and not somewhere else &#8211; it helps both for readability for test (you see all inputs in test) as well as maintainability (if related things are stored in different places then it is harder to notice what else should be changed).</p>
<p>And I also recommend to separate unit tests (where you validate logic on specific small examples and test all different edge cases) from performance / integration tests where you test just some basic scenarios on large data volumes.</p>
<p>And last comment about &#8220;PL/SQL developer&#8221;. If the only tool you have is hammer then all problems seem to be nails :) Good software developer should have several tools and apply the right tool for the right problem. If PL/SQL is not a good language for testing (which could be seen from failure of utPLSQL project) then good developers should look for better tools for the job. And dynamic languages like Ruby or Python are better for such task. And you shouldn&#8217;t be an expert Ruby programmer to use this approach &#8211; the amount of learning of described framework probably is similar to learning GUI testing frameworks like Quest Code Tester or SQL Developer unit testing. And I am eager to help with advice and suggestions how to learn this approach faster :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jva</title>
		<link>http://blog.rayapps.com/2009/11/27/oracle-plsql-unit-testing-with-ruby/#comment-1018</link>
		<dc:creator>jva</dc:creator>
		<pubDate>Fri, 27 Nov 2009 14:54:55 +0000</pubDate>
		<guid isPermaLink="false">http://rayapps.wordpress.com/?p=124#comment-1018</guid>
		<description>Second thought:

Maybe I&#039;m not the target audience for this tool. I&#039;m a PL/SQL developer, writing almost exclusively PL/SQL code. Introducing lots of Ruby code would be huge overhead all by itself. Your approach would probably be usefull to people that only occasionaly step out of Ruby to write a bit of PL/SQL and already have a working knowledge of unit testing for Ruby.</description>
		<content:encoded><![CDATA[<p>Second thought:</p>
<p>Maybe I&#8217;m not the target audience for this tool. I&#8217;m a PL/SQL developer, writing almost exclusively PL/SQL code. Introducing lots of Ruby code would be huge overhead all by itself. Your approach would probably be usefull to people that only occasionaly step out of Ruby to write a bit of PL/SQL and already have a working knowledge of unit testing for Ruby.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jva</title>
		<link>http://blog.rayapps.com/2009/11/27/oracle-plsql-unit-testing-with-ruby/#comment-1017</link>
		<dc:creator>jva</dc:creator>
		<pubDate>Fri, 27 Nov 2009 14:31:02 +0000</pubDate>
		<guid isPermaLink="false">http://rayapps.wordpress.com/?p=124#comment-1017</guid>
		<description>In my experience the following is true:

1) trivial code == trivial unit tests
2) non-trivial code == non-trivial unit tests

Because of this one has to take different approaches to readability for different scales of testing. 
Want to test 3 line procedure that changes one field in a table with no triggers? Sure, you can easily generate tests using whatever methodology you like. But you shoud try to create tests that use data from some 20 different tables that totals to 400+ fields and 100+ total records that all can influence outcome and also include transaction management. Oh, and that outcome is not a single return value, but some possible inserts/updates in any number of other tables. That is actually too much data to *see together* for any test. So how should people manage it? Is it really that much better to store it in plaintext than it would be in database? Are CSV files better than INSERT INTO scripts? I think it is *data* that influences how things behave in *database*, so I say that it should reside in that same *database*. (You can store data generation scripts in version control, sure.) Anyway, does it really matter, how you generate your data on this scale? I&#039;ve yet to see how can it not be ugly one way or another. 

TL;DR version:
this does not address my problems with automated pl/sql testing, just ads another layer of abstraction. And we all know what Joel said about abstractions :(</description>
		<content:encoded><![CDATA[<p>In my experience the following is true:</p>
<p>1) trivial code == trivial unit tests<br />
2) non-trivial code == non-trivial unit tests</p>
<p>Because of this one has to take different approaches to readability for different scales of testing.<br />
Want to test 3 line procedure that changes one field in a table with no triggers? Sure, you can easily generate tests using whatever methodology you like. But you shoud try to create tests that use data from some 20 different tables that totals to 400+ fields and 100+ total records that all can influence outcome and also include transaction management. Oh, and that outcome is not a single return value, but some possible inserts/updates in any number of other tables. That is actually too much data to *see together* for any test. So how should people manage it? Is it really that much better to store it in plaintext than it would be in database? Are CSV files better than INSERT INTO scripts? I think it is *data* that influences how things behave in *database*, so I say that it should reside in that same *database*. (You can store data generation scripts in version control, sure.) Anyway, does it really matter, how you generate your data on this scale? I&#8217;ve yet to see how can it not be ugly one way or another. </p>
<p>TL;DR version:<br />
this does not address my problems with automated pl/sql testing, just ads another layer of abstraction. And we all know what Joel said about abstractions :(</p>
]]></content:encoded>
	</item>
</channel>
</rss>
