Unit Testing T-SQL Code with tSQLt
Covering how and why to unit test, examples and potential pitfalls, this course leads the SQL developer through using an open source framework to add unit tests to existing as well as new database developments.
What you'll learn
SQL Server developers have, until recently, been unable to benefit from unit testing to produce reliable code which can be properly regression tested at the unit level.
Covering how and why to unit test, examples and potential pitfalls, this course leads the SQL developer through how to use tSQLt when going about adding unit tests to existing as well as new database developments.
We will be using the tSQLt open source framework and the Red Gate SQL Test tool to show how to easily add database unit testing to your development armory. The methods shown in this course apply to SQL Server versions 2005 and above.
Learn more about T-SQL unit testing with tSQLt today!
Table of contents
- Introduction 0m
- What is a dependency? 2m
- Why isolate from other areas of code? 1m
- Isolating from Tables 2m
- Faking our Tables 3m
- Testing no Data 2m
- Using Setup Routines 1m
- Converting our Tests to use a Setup Procedure 2m
- Isolating from Stored Procedures 2m
- Testing other Stored Procedures are Called Correctly 4m
- Isolating from Functions 3m
- Limitations of Isolation 1m
- Summary 1m
- Introduction 0m
- What is an Assertion? 2m
- Combining Assertions in a Test 2m
- Testing data in Tables 2m
- Demo - AssertEqualsTable 3m
- Checking for Empty Tables 3m
- Checking Meta Data 2m
- Demo - AssertResultSetsHaveSameMetaData 4m
- A Review of Table Assertions 1m
- Checking Strings 1m
- Demo - AssertEqualsString 3m
- Checking Patterns in Strings 1m
- Demo - AssertLike 3m
- Checking Values 1m
- Demo - AssertEquals 2m
- A Review of Strings and Values 1m
- Testing for the Existance of Objects 1m
- Demo - AssertObjectExists 2m
- Exception Handling 2m
- Demo - ExpectException 2m
- Demo - ExpectNoException 1m
- A Review of Objects and Exceptions 1m
- Summary 1m
- Introduction 1m
- How to Approach Writing Tests 2m
- Setting up a Scenario 3m
- Testing Tests 1m
- Do I need to test everything? 2m
- What if my test fails? 2m
- Do you work alone? 2m
- Deciding on Conventions 1m
- Naming test Classes 2m
- Naming Tests 2m
- Understandable Tests 2m
- Sharing Tests 2m
- Source Controlling Tests 1m
- Where do tests belong? 1m
- Removing Tests from the Database 4m
- When should I run tests? 2m
- Summary 1m
- Introduction 1m
- Insert Exec Behaviour 5m
- Getting a Specific Result Set 5m
- Insert Exec use in Stored Procedures 2m
- What are we missing? 1m
- Checking Constraints 3m
- Checking Foreign Keys 4m
- More Complex Requirements 2m
- Using tSQLt to Enforce Development Standards 5m
- Breaking out of the Transaction 5m
- Summary 1m