Red Gate forums :: View topic - Why do SQL Test Messages appear doubled?
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Test
SQL Test forum

Why do SQL Test Messages appear doubled?

Search in SQL Test forum
Post new topic   Reply to topic
Jump to:  
Author Message
bootieday



Joined: 30 Aug 2005
Posts: 11

PostPosted: Tue Feb 11, 2014 10:18 pm    Post subject: Why do SQL Test Messages appear doubled? Reply with quote

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 |
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6678

PostPosted: Thu Feb 13, 2014 1:29 pm    Post subject: Reply with quote

What are the contents of the test stored procedure?

I am guessing that AssertEqualsTable will write its' own failure output so it's not necessary to also write your own failure message.
Back to top
View user's profile Send private message
David Priddle



Joined: 28 Jan 2014
Posts: 36
Location: Red Gate Software, Cambridge

PostPosted: Thu Feb 13, 2014 4:04 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail
bootieday



Joined: 30 Aug 2005
Posts: 11

PostPosted: Thu Feb 13, 2014 7:14 pm    Post subject: Reply with quote

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;
Back to top
View user's profile Send private message
David Priddle



Joined: 28 Jan 2014
Posts: 36
Location: Red Gate Software, Cambridge

PostPosted: Fri Feb 14, 2014 12:30 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group