Command line tool for running tSQLt unit tests from MSBuild.Sdk.SqlProj projects inside throwaway instances of Docker containers for all compatible SQL Server images.
Install the tool from the package:
dotnet tool install --global dotnet-sqltest
Update the tool to newer version:
dotnet tool update --global dotnet-sqltest
Invoke the tool:
sqltest runall [options]
Options:
-p, --project <project> (REQUIRED) Database project
-i, --image <image> Docker image
-c, --collation <collation> Server collation
-r, --result <result> Save result to JUnit XML file
--cc-cobertura <cc-cobertura> Save code coverage to Cobertura XML file
--cc-disable Disable code coverage
--cc-include-tsqlt Include code coverage of tSQLt schema
-?, -h, --help Show help and usage information
Running all tSQLt tests inside throwaway SQL Server container:
sqltest runall --project Database.Tests/Ok --image mcr.microsoft.com/mssql/server
Preparing database... 6 s
Deploying database... 10 s
Running all tests.... 435 ms
Gathering coverage... 1 s
Uncovered statements:
[dbo].[Example]: SELECT A = 1 INTO #Example
[dbo].[Example]: UPDATE #Example SET [...]
Failed: 0, Passed: 1, Coverage: 60% (3/5), Duration: 18 s
dotnet-sqltest is build with .NET 8 and .NET 10.
Powered by: