Search code examples
sql-servert-sqltsqlt

tSQLt - Re. Tests and SQL transactions


In the tSQLt framework, I am aware that every test runs as a transactions.

Questions:

  1. Are the tests run one after another (that is - wait for one test to finish before starting another test) OR do tests run in parallel?
  2. Does each test have its own transaction?
  3. The 'Setup' SP (if any) that runs prior to test execution. Does this also run in a transaction? Is this the individual test's transaction?

Solution

    1. One at a time in random order. (Too many blocking issues trying to parallelize it.)

    2. Yes. Each test runs in it’s own transaction.

    3. The setup procedure is executed inside each test’s transaction. (There is currently no setup on the test class level.)