Hi,<br><br>here&#39;s my first and very raw (but quite successful) attempt at writing an automated test for a real .ctl file, without requiring any modifications to the .ctl file itself nor to AW-ETL.<br><br>The idea here is to mock the sources and destinations of a real .ctl file: I replace all the sources by one mock source (eg: array of hashes), and replace all the destinations by one, on which I assert to see if the requirements are met. The connection to :etl_execution and the job creation are also mocked, to avoid a database dependency and focus on the transforms.
<br><br>With the plumbing removed, the test can be written:<br><br>describe &quot;test.ctl&quot; do<br>&nbsp; it &quot;should store :first_name + :last_name under :name&quot; do<br>&nbsp;&nbsp;&nbsp; load &#39;test.ctl&#39;, [ {:first_name =&gt; &#39;john&#39;,:last_name =&gt; &#39;barry&#39;} ]
<br>&nbsp;&nbsp;&nbsp; @destination.should_receive(:write).with( { :first_name =&gt; &#39;john&#39;, :last_name =&gt; &#39;barry&#39;, :name =&gt; &#39;john barry&#39; } )<br>&nbsp; end<br>end<br><br>This specification is written with RSpec and takes benefits of the mocking abilities it provides (will be very practical to mock dimensions foreign-key look-ups as well).
<br>The plumbing was surprisingly easy to write, although it definitely requires polishing (for instance, running two tests in a row won&#39;t work today!).<br>I think it would be reasonably easy to make AW-ETL more test-friendly by refactoring some areas in order to remove part or all of the plumbing I wrote to get this to work.
<br><br>What do you think ?<br><br>cheers<br><br>Thibaut<br>