All,
Over the last few weeks I have been working on a proof-of-concept (POC) and taking a lot from the dbfit and fitnesse user communities. Yesterday I was finally successful! This post is to give thanks to the individuals around the world on three continents that help me get this far and try to give a little back.
Thank you,
Brian
As a project manager I wanted a mechanism to help developers effectively unit test DataStage (ETL) code in a DB2 database environment so we could begin to recognize the benefits of test driven development.
I used the 1.1 version of dbfit (dbfit-complete-20080822.zip) to connect to DB2, insert test data and query for expected results & Uncle Bob’s Command Line Fixture to run the DataStage jobs.
I selected the 1.1 version of dbfit because it is the only one that supports DB2. As of 08/23/2012 neither FitSharp nor FitLibraryWeb contains a version of dbfit the supports DB2.
While I would have preferred to use DataStage’s APIs over the command line interface, I decided against it: I am not a coder and I was told I would need to write wrappers for the DataStage C/C++ APIs. For a POC that was just a bridge too far.
NOTE: I think a custom fixture invoking the APIs would provide at least two benefits that the command line does not: a testable return result and leverage of the existing database connection.
Additionally, I selected the java implementation (as opposed to the .NET version) of dbfit 1.1 because Uncle Bob’s Command Line Fixture is written in java. After watching Eclipse and Java for Total Beginners I felt comfortable with the limited effort required by me to build the code and deploy the fixture.
For the POC test itself I believe I am using dbfit in standalone mode: I am a little fuzzy on why. I believe it has something to do with preventing dbfit from controlling the test page, which I had to do in order to run the command line fixture. It also may be necessary because I had to have a couple COMMIT statements in my test because I am using two different database connections (my dbfit fixtures and command line fixture did not share a common database session).
The test:
|import fixture|
|myFixtures|
|import fixture|
|dbfit.fixture|
!|Database Environment|DB2|
|Connect Using File|DB2Connection.properties|
!*****> Data Setup
|Query|Select * from DIM_STORE_SOURCE|
|STORE_IDENTIFIER|STREET_ADDRESS_2|
|Query|Select * from DIM_STORE_TARGET|
|STORE_IDENTIFIER|STREET_ADDRESS_2|
!|Insert|DIM_STORE_SOURCE|
|STORE_MANAGER_FNAME|STORE_MANAGER_LNAME|STORE_MANAGER|STREET_ADDRESS_1|STREET_ADDRESS_2|CITY|STATE_ABBREVIATION|STATE_NAME|ZIP|COUNTY_NAME|STORE_PHONE_NUM|DIVISION_CODE|REGION_CODE|AREA_CODE|OPEN_DATE|DIM_STORE_EFFECTIVE_DATE|DIM_STORE_EXPIRATION_DATE|CURRENT_IND|STORE_IDENTIFIER?|
|Brian|Gibson|Brian Gibson|123 Main Street|Suite 100|Roanoke|VA|Virginia|24011|USA|1111111111|1234|12|1|2010-01-01|2010-01-02|2500-12-12|Y|>>id1|
|Brian|Gibson|Brian Gibson|123 Main Street|Suite 100|Roanoke|VA|Virginia|24011|USA|1111111111|1234|12|1|2010-01-01|2010-01-02|2500-12-12|Y|>>id2|
!|Insert|DIM_STORE_TARGET|
|STORE_IDENTIFIER|STORE_MANAGER_FNAME|STORE_MANAGER_LNAME|STORE_MANAGER|STREET_ADDRESS_1|STREET_ADDRESS_2|CITY|STATE_ABBREVIATION|STATE_NAME|ZIP|COUNTY_NAME|STORE_PHONE_NUM|DIVISION_CODE|REGION_CODE|AREA_CODE|OPEN_DATE|DIM_STORE_EFFECTIVE_DATE|DIM_STORE_EXPIRATION_DATE|CURRENT_IND|
|<<id1|Brian|Gibson|Brian Gibson|123 Main Street|Suite 200|Roanoke|VA|Virginia|24011|USA|1111111111|1234|12|1|2010-01-01|2010-01-02|2500-12-12|Y|
**********!
Two records are inserted into the source table:
One that does exist in the tartget (id1) to test it is updated properly
One that does not exist in the target (id2) to test it is inserted properly
|Query|Select * from DIM_STORE_SOURCE|
|STORE_IDENTIFIER|STREET_ADDRESS_2|
|<<id1|Suite 100|
|<<id2|Suite 100|
|Query|Select * from DIM_STORE_TARGET|
|STORE_IDENTIFIER|STREET_ADDRESS_2|
|<<id1|Suite 200|
!|Database Environment|
|Commit|
!|Command Line Fixture|
|command|C:\IBM\InformationServer\Clients\Classic\dsjob.exe -file C:\IBM\InformationServer\Clients\Classic\DSConnection.properties sdissm01:9080 SDISS01 -run -mode NORMAL -jobstatus -warn 10 PROJ_EDW DBFitTest_DIM_STORE|
|Query|Select * from DIM_STORE_SOURCE|
|STORE_IDENTIFIER|STREET_ADDRESS_2|
|<<id1|Suite 100|
|<<id2|Suite 100|
|Query|Select * from DIM_STORE_TARGET|
|STORE_IDENTIFIER|STREET_ADDRESS_2|
|<<id1|Suite 100|
|<<id2|Suite 100|
|Clean|
|table|clean?|
|DIM_STORE_SOURCE|true|
|DIM_STORE_TARGET|true|
!|Database Environment|
|Commit|
!|dbfit.util.ExportFixture|
|dbfit.fixture|
Mark,Hello. Is there an ETA of the FitLibraryWeb update that includes DB2 and Teradata support?Thanks,Jaison
When you say 'only supports .net version' what are you referring to?