cagrin / tSQLt-edge

tSQLt-compatible unit testing framework for Azure SQL Edge, SQL Server 2019 and 2022.

Home Page:https://www.nuget.org/packages/tSQLt.Edge

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NuGet Nuget

tSQLt-edge

tSQLt-compatible unit testing framework for Azure SQL Edge, SQL Server 2019 and 2022. It is available as a nuget package and works perfectly with MSBuild.SDK.SqlProj project format.

Description

This project was created in order to practice code writing in TDD. Here are some detailed principles I was followed:

  • Use modern Sql150 syntax
  • Do not use CLR code
  • Use CONCAT or CONCAT_WS instead of adding strings (+)
  • Use STRING_AGG instead of concatenate strings with FOR XML PATH
  • Use tSQLt assertions in internal tests

Compatibility

tSQLt-edge is mostly fully compatible with tSQLt unit testing framework. See full user guide for more details about tSQLt.

The default method of calling tSQLt.NewTestClass to create a tSQLt test class (the schema to organize your unit tests) does not work either in Visual Studio database projects nor MSBuild.SDK.SqlProj projects. That is why tSQLt-edge entirely drop support for NewTestClass, DropClass and RenameClass.

Status
Fully compatible
Large or partial support
Unsupported

Test creation and execution:

Assertions:

Expectations:

Isolating dependencies:

Extentions

tSQLt-edge has some additional features:

Stored procedure Description
ApplyIndex Same as ApplyConstraint, but for INDEXES
AssertEqualsTable Add XML column comparison using convertion to NVARCHAR(MAX)
AssertNotEqualsString Same as AssertNotEquals, but for NVARCHAR(MAX)
FakeTable Add @NotNulls optional parameter to preserve NOT NULLs
SpyProcedure Add @CatchExecutionTimes optional parameter to catch execution times in _SpyProcedureLog

tSQLt-edge can operate on different database, same server:

Stored procedure with external objects support
ApplyConstraint
ApplyIndex
ApplyTrigger
AssertEmptyTable
AssertEqualsTable
AssertEqualsTableSchema
AssertObjectDoesNotExists
AssertObjectExists
FakeFunction
FakeTable
RemoveObject
RemoveObjectIfExists
SpyProcedure

About

tSQLt-compatible unit testing framework for Azure SQL Edge, SQL Server 2019 and 2022.

https://www.nuget.org/packages/tSQLt.Edge

License:MIT License


Languages

Language:TSQL 98.9%Language:C# 1.1%Language:Shell 0.0%