Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Writes, runs, and debugs tSQLt unit tests for SQL Server, including fakes, spies, and assertions.
73% 100%+27 ptsof test cases passed
Passed 22 of 22 test cases with the skill, and 16 of 22 without it.
3 of 3 safety checks passed
Not used yet
tSQLt is a unit-testing framework that runs inside SQL Server. Tests live in the database alongside the code they exercise.
EXEC tSQLt.NewTestClass '<ClassName>';[<ClassName>].[test <description>] — the test prefix is required.[<ClassName>].SetUp procedure runs before every test in the class.<Name>Tests.class.sql that starts with
EXEC tSQLt.NewTestClass '<Name>Tests'; then GO.CREATE PROCEDURE <Class>.[test ...] and AAA comments.tSQLt.FakeTable — replace a table with an empty, constraint-free copy you populate yourself.tSQLt.FakeFunction — replace a function with a fake of the same signature.tSQLt.SpyProcedure — replace a procedure with a logging stub (optionally still call the original).
See reference/isolation-and-mocking.md.reference/assertions.md). Most common: AssertEquals (scalars),
AssertEqualsTable (row data), ExpectException (errors).Then deploy the class and run it (EXEC tSQLt.Run '<Class>' / EXEC tSQLt.RunAll) — see
reference/running-and-results.md. Use whatever deploy/run tooling the project provides; check its README
or CLAUDE.md. Iterate until green.
Two habits that keep tests honest:
reference/test-conventions.md.reference/isolation-and-mocking.md.EXEC tSQLt.NewTestClass 'MyTests';
GO
CREATE PROCEDURE MyTests.[test total sums the order lines]
Next to this one in the catalogue, plus more from the same author.