Questions tagged [tsqlt]

An open source database unit testing framework for SQL Server.

TSQLT allows unit tests written in T-SQL. tSQLt supports SQL Server versions 2005 and above. See http://tsqlt.org/ for more information.

6 questions
6
votes
1 answer

Why does SQL Server sometimes estimate that joining onto an empty table will increase the row count?

I recently came across an issue where tSQLt tests were taking a long time to run. The procedure under test was doing a 38 table (!) join (with 37 faked tables and a table valued parameter). Only two of the faked tables and the TVP had any rows…
Martin Smith
  • 87,941
  • 15
  • 255
  • 354
6
votes
2 answers

Why would I get PREEMPTIVE_OS_AUTHORIZATIONOPS using tSQLt when Working at Home?

I have an SSDT project containing tSQLt unit tests. I always find when working at home that publishing this and running all tests (from a post deploy script) is problematic (against both localdb and SQL Server developer edition). The publish hangs…
Martin Smith
  • 87,941
  • 15
  • 255
  • 354
2
votes
2 answers

tSQLt test problem for some DDL queries

I am a SQL Server DBA. To automate some of my daily tasks, I need to write stored procedures. Creating functionality without testing does not make sense to me. For creating and running my tests, I used the tSQLt Framework. I had to create a database…
Meyssam Toluie
  • 227
  • 1
  • 11
2
votes
1 answer

Resource consuming query

I have found below CPU consuming query with a query cost of 1540. I have tried creating appropriate indexes which reduced the query cost to 1234 but still, the query is expensive. Index Created : CREATE NONCLUSTERED drop INDEX…
Aditya
  • 33
  • 1
  • 4
2
votes
2 answers

Are SQL unit tests supposed to be so long?

I am writing stored procedures with some non-trivial business logic. I am trying to unit test them, but the actual tests end up being quite long (shorter ones starting at 40-50 LoCs, using commonly 4 different tables), which doesn't seem very…
IvanLoginov
  • 103
  • 1
  • 7
1
vote
2 answers

Why shouldn't I use tSQLt in production?

I want to use tSQLt framework for unit testing my T-SQL queries. However documentation warns: Note: tSQLt should never be installed in production. In my case I have single instance of SQL Server, containing both production databases and dev…
J. Doe
  • 140
  • 4