Start testing your SSIS packages with ssisUnit SQL Saturday Oslo, 1st September 2018
A big thanks to all of our sponsors!
Download the slides and the code http://www.sqlsaturday.com/746/Sessions/Schedule.aspx https://github.com/BartekR/ssisUnitLearning Read more: https://blog.bartekr.net
Bartosz Ratajczyk SQL Server consultant @ 7N, trainer Works with SQL Server for over 12 years Advisory Board member of Data Community Poland SQLDay conference co-organizer Open source contributor (dbatools, ssisUnit) SQL Saturday volunteer @b_ratajczyk https://bartekr.net
„I’m already testing…” Manually setting the parameters Manually running the packages Manually disabling the tasks Manually enabling them again Manually running the code in SSMS Are you sure the table has 0 records? Did you commit with all tasks enabled? Is it setting the variable’s value? Does it work with unexpected parameters?
How about Writing tests for the packages or tasks? Running tests automatically? Using free tools? (or free and paid if you wish)?
My goal (achieved)
SSIS testing options Write your own solution SSISTester BEST (BIML Enabled SSIS Test) ssisUnit BiXpress LegiTest ORAYLIS BI.Quality DbFit BizUnit Write your own: https://kzhendev.wordpress.com/2014/05/21/building-an-ssis-testing-framework/ (Kenneth Ross) https://kevinholditch.co.uk/2017/04/21/integration-testing-ssis-etl-packages/ (Kevin Holditch) https://github.com/kevholditch/SSISIntegrationTesting SSISTester http://bytesoftwo.com https://msdn.microsoft.com/en-us/magazine/dn342874.aspx BEST https://github.com/bimlscript/best Scott Currie (PASS Summit 2014) A New Approach to Unit Testing and Integration Testing in SSIS Reeves Smith (SQL Rally 2015) Reeves Smith_A New Approach to Unit and Integration Testing in SSIS ssisUnit https://github.com/johnwelch/ssisUnit BiXpress / Pragmatic Workbench SSIS Unit LegiTest http://www.legitest.com/ BI.Quality https://archive.codeplex.com/?p=biquality DbFit http://dbfit.github.io/dbfit/ https://blogs.perficient.com/2012/06/07/bi-tools-testing-with-dbfit/ BizUnit https://github.com/BizUnit/BizUnit http://msbistack.blogspot.com/2011/10/automated-unit-testing-for-ssis-using.html LegiTest Green == commercial tool
ssisUnit Why, and what is it?
ssisUnit Testing framework by John Welch Open source, C#, XML With a GUI and an API Released on CodePlex in 2008 Works with SSIS 2005 – 2014 (and 2017) Used in Pragmatic Workbench (only for SSIS 2005 – 2014)
ssisUnit Test Suite Test Suite contains Tests Tests have Asserts (definitions of the expected test outcome) Asserts have Commands (run to get the test outcome) Tests apply to Packages and tasks in the packages Commands can use Connections and Datasets Tests and Test Suite can have Setup and Teardown phases
Commands Project and package parameters Comparing data Working with directories Using files Running programs Package and project properties Running SQL code Operations on variables
Test file structure
Test fragment
Libraries SsisUnitBase.dll (< 20kB) SsisUnit<version>.dll SsisUnit2017.dll (< 150 kB)
DEMO Starting with ssisUnit
Starting simple Parameters Variables Expressions Variables scope Sensitive values ParameterCommand VariableCommand
Getting further Merging data with SQL Task SqlCommand DataCompareCommand
Automation ssisUnit + MSTest + TFS
Why use an additional test framework? ssisUnit has its own test runners (GUI + cmd) Both not suitable for easy automation and analysis Let’s use a test runner from VS! http://www.ravipal.net/2016/03/ssis-unit-testing-with-ssisunit.html https://github.com/rarpal/SampleSSISUnit
DEMO Using ssisUnit with MSTest and TFS
Starting simple with MSTest – [TestMethod]
(and some additional methods)
Getting a bit further – T4 template
Target acquired
Step forward – using ssisUnit API
Summary ssisUnit helps you easily start with testing (GUI) You can integrate it with CI/CD tools You can write the tests in XML or using ssisUnit API
Now, ask me some questions
A big thanks to all of our sponsors!