Awesome
dotnet-sqltest
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.
Usage
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:
-i, --image <image> Docker image.
-p, --project <project> Database project.
-c, --collation <collation> Server collation.
-r, --result <file> Save result to JUnit XML file.
--cc-cobertura <file> 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
Example
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
Build
dotnet-sqltest is build with .NET 6 and 8.
Powered by: