Options

Why do SQL Test Messages appear doubled?

bootiedaybootieday Posts: 18
edited February 14, 2014 6:30AM in SQL Test
When a unit test fails, I see output like this (for AssertEqualsTable test with my own Failure msg). Why does the mismatched data appear twice in the SQL Test Messages window?

Test Class: foo
TestClassName.TestName failed: UPDATE expected table does not match actual
|_m_|col1|col2|col3|
+---+----+----+----+
|< |2 |B |b |
|> |2 |B |b |
UPDATE expected table does not match actual
|_m_|col1|col2|col3|
+---+----+----+----+
|< |2 |B |b |
|> |2 |B |b |

Comments

  • Options
    Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    What are the contents of the test stored procedure?

    I am guessing that AssertEqualsTablewill write its' own failure output so it's not necessary to also write your own failure message.
  • Options
    Hi bootieday,

    We've just released a beta build of SQL Test that should fix your issue with the duplication of test results in the messages window:

    http://www.red-gate.com/MessageBoard/viewtopic.php?p=67784

    Please let us know if this works for you!

    Best regards,

    David
  • Options
    Here is a simplified version of what produces the doubled output. I tested it by removing the @FailMsg parameter and it is still doubled.

    -- Tests the case of no rows returned from the dependent tables referenced by SELECT
    -- For test case examples, see: http://tsqlt.org/user-guide/tsqlt-tutorial/
    ALTER PROCEDURE [DependentTablesTests].[test no rows in SELECT]
    AS
    BEGIN
    IF OBJECT_ID('expected') IS NOT NULL DROP TABLE expected

    --Assemble
    DECLARE @CID NVARCHAR(50)
    SET @CID = '7000'
    DECLARE @JID INT
    SET @JID = 7000

    EXEC tSQLt.FakeTable 'dbo', 'tblJC'

    INSERT INTO dbo.tblJC
    ( JobID ,
    ClientID ,
    Cost
    )
    VALUES ( @JID , -- JobID - int
    @CID , -- ClientID - nvarchar(50)
    0.0 -- Cost - float
    )
    SELECT
    *
    INTO expected
    FROM
    dbo.tblJC

    --Act
    EXEC dbo.Proc_TESTED_CODE @JID, @CID

    --Assert
    EXEC tSQLt.AssertEqualsTable @Expected = N'expected', -- nvarchar(max)
    @Actual = N'dbo.tblJC', -- nvarchar(max)
    @FailMsg = N'Table tblJC actual does not match expected' -- nvarchar(max)


    END;
  • Options
    Hi bootieday,

    Unfortunately I can't run your code to reproduce this, as it depends on tblJC and Proc_TESTED_CODE.

    Can you confirm that you're using the latest 1.5 beta version of SQL Test?

    Best regards,

    David
Sign In or Register to comment.