What problem does it solve?
This Skill provides a comprehensive guide and checklist for writing robust, maintainable, and isolated unit tests for SQL Server stored procedures using the tSQLt framework, ensuring code quality and reliability.
Core Features & Use Cases
- Test Structure & Naming: Enforces consistent naming conventions and organization for test classes and individual tests.
- Isolation Techniques: Details the use of
FakeTable, SpyProcedure, and FakeFunction to isolate tests from external dependencies.
- Assertion Guidance: Explains various assertion types and provides patterns for validating results, especially for financial data.
- Pitfall Avoidance: Highlights common mistakes like identity column loss and transaction rollback issues, offering solutions.
- Use Case: When developing a new stored procedure for financial transactions, use this Skill to ensure all edge cases, such as insufficient funds or idempotency, are covered by well-structured tSQLt unit tests.
Quick Start
Review the provided checklist to ensure the tSQLt unit tests for the 'Banking.usp_TransferFunds' stored procedure adhere to all hard rules and best practices.