tSQLt - Database Unit Testing for SQL Server

Database Unit Testing for SQL Server

  • Home
  • Docs
    • Documents
    • Quick Start
    • Articles
  • Training
  • Downloads

Welcome to tSQLt, the open source database unit testing framework for SQL Server

Unit testing has been a common and accepted practice in application development for a long time. By testing certain functions and areas – or units – of code, it verifies those functions work as expected, and improves the quality of code.

tSQLt brings the same advantages to SQL Server database development, and is compatible with all editions of SQL Server from the 2005 Service Pack 2 edition onwards.

Importantly, because tSQLt allows you to implement unit tests in T-SQL, you don’t have to switch between various tools to create the code and unit tests. tSQLt also provides the following features to make it easier to create and manage unit tests:

  • Tests are automatically run within transactions – this keeps tests independent and reduces any cleanup work
  • Tests can be grouped together within a schema – allowing you to organize your tests and use common setup methods
  • Output can be generated in plain text or XML – making it easier to integrate with a continuous integration tool
  • The framework gives you the ability to fake tables and views, and create stored procedure spies – allowing you to isolate the code being tested

Even if you have a large code base and no existing unit tests, you can start introducing tests now to make your database code more robust to change.

So download the latest version of tSQLt, read the Full User Guide or follow our Quick Start guide if you’re in a hurry. And, if you want to make the most of tSQLt, browse through our library of articles.

 

 

Share and Enjoy:
  • FacebookFacebook
  • TwitterTwitter
  • LinkedInLinkedIn
  • RedditReddit
  • StumbleUponStumbleUpon
  • TechnoratiTechnorati
  • PrintPrint

Navigation

  • Full user guide
  • Why you should use the tSQLt framework
  • How to get more out of tSQLt
  • Join the conversation
  • Downloads
  • Articles
  • Release Notes
  • New Logo
  • Training
  • Sponsors & Contributors
  • Why you should unit test SQL Server Code
  • Documents
    • Quick Start
    • tSQLt Tutorial
    • tSQLt Keyboard Shortcuts
    • Test Creation and Execution
      • NewTestClass
      • DropClass
      • RunAll
      • Run
      • RenameClass
    • Assertions
      • AssertNotEquals
      • AssertEmptyTable
      • AssertEquals
      • AssertEqualsString
      • AssertEqualsTable
      • AssertObjectExists
      • AssertResultSetsHaveSameMetaData
      • Fail
      • AssertObjectDoesNotExist
      • AssertEqualsTableSchema
      • AssertLike
    • Expectations
      • ExpectException
      • ExpectNoException
    • Isolating Dependencies
      • ApplyConstraint
      • FakeTable
      • SpyProcedure
      • FakeFunction
      • RemoveObjectIfExists
      • ApplyTrigger
      • RemoveObject

Links

  • tSQLt on GitHub
  • tSQLt Mailing List
  • twitter hashtag (#tsqlt)
  • tSQLt tag on stackoverflow.com
  • SQL Server Community on Slack (#tsqlt)
  • #tSQLtLive on YouTube

Sponsors

sqlity.net
redgate.com

A sqlity.net llc Web Property. | ©2010 - 2020, All Rights Reserved. | Privacy Policy | Terms of Use