common unit tests

Mar 26, 2009 at 9:52 PM
What are some of the most common unit tests that people use ssisUnit to test? What generally does your setup and teardown do? How painful was the setup of the test, and has it been valuable to have that unit test setup?

Just looking for some advice on what some recommended tests are.
Mar 27, 2009 at 8:09 AM
Only getting started with ssisUnit, so no expert ...

I've put in tests for each of the stages of my packages, so the setup is usually getting the database to a "known" state, so usually a bit of SQL with TRUNCATE TABLE followed by INSERT's
- don't think this is the best way though, as the editor dialog in ssisUnit is very basic
- I like to use SQLPrompt (from Redgate) in SSMS ... its intellisense is great
- then cut and paste the SQL over
- it'd be nice to be able to leave that bits of SQL as files and get ssisUnit to call them somehow

Not used teardown much at all, only got an "uber cleanup", which removes temp directories and files
Mar 27, 2009 at 6:00 PM
I use it to validate my data flow tasks, and any control flow tasks that rely on expressions. I also use it to drive the execution of the entire package, so that I can test that as one unit.

I normally use the TestSetup and Teardown to make sure things are in a known state before testing. For example, if I'm testing a data flow that imports a flat file into a database table, I might use the setup to copy my file with test data to the appropriate directory, and the teardown to delete the test file. If I'm testing a table to table data flow, I use the test setup to insert rows into the source table that will exercise all the data paths and logic in my data flow, and I use the teardown to delete the test rows from the source and the destination.

Test setup is time consuming, and probably the most painful part of the process. It can be simplified by having a test database, taking a snapshot prior to beginning any tests, running the tests, and then reverting the snapshot at the end. I've found that greatly reduces the amount of SQL I have to include in my unit tests. The suggestion about letting it pull the SQL in from a file is good, I'll add that to the work items.
Mar 27, 2009 at 6:03 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.