SQL Server Unit Testing in Visual Studio

  • David Fundakowski

    Ten Centuries

    Points: 1310

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

  • v.malyutin

    SSChasing Mays

    Points: 602

    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.

  • philcart

    SSC-Forever

    Points: 47794

    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

  • hatvani.sandor

    Grasshopper

    Points: 21

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

  • Misha_SQL

    SSCertifiable

    Points: 5401

    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.

  • Bryga.Mike

    Newbie

    Points: 1

    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 6 (of 6 total)

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