SQL Server Unit Testing in Visual Studio

  • Comments posted to this topic are about the item SQL Server Unit Testing in Visual Studio

  • Unit testing is not about running an SP and reading the results. It is all about mocking, stubbing and faking and running in CI. That's why I do not use Microsoft's solution.

    But now it appeared that the solution I use is not compatible with Columnstore indexes. That is sad to me.

  • Tried doing this, but for some reason the "Create Unit Tests..." option is disabled.
    Running Visual Studio Professional 2015 v 14.0.25431.01 Update 3
    SQL Server Data Tools v 14.0.61021.0

    --------------------
    Colt 45 - the original point and click interface

  • Can I run multiple tests in one class, please?
     I would like to test multiple conditions against stored procedure.

  • Can somebody comment on how this compares to using the T-SQL-t framework.  I have only a general idea about, but haven't used it in the real world.

  • I'm having trouble using some of the newer/odder INSERT/SELECT INTO syntax's

    They run just fine from a .SQL dialog from VS2015, but not within a SQL unit-test.

    In all cases I am populating a temp table and using MSSQL 2015.

    This standard syntax works just fine in both a SQL unit-test and as a SQL script in DevStudio;

    INSERT INTO #Expect ([Name], [System_Type_Name]) VALUES ('Mail_Option', 'Varchar(20)')

    However, these will not work in a unit-test but if you copy-n-paste into a script they work fine;

    SELECT * INTO #Actual FROM OPENROWSET('sqlncli', 'server=xxx;Trusted_Connection=yes;','EXEC xxx')

    or

    INSERT INTO #Actual EXEC dbo.Xxx

    The error is;

    System.Data.SqlClient.SqlException: Incorrect syntax near the word 'INTO'.

    Your help is appreciated.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply