Hi,<br><br>here'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 "test.ctl" do<br> it "should store :first_name + :last_name under :name" do<br> load 'test.ctl', [ {:first_name => 'john',:last_name => 'barry'} ]
<br> @destination.should_receive(:write).with( { :first_name => 'john', :last_name => 'barry', :name => 'john barry' } )<br> 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'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>