I am currently investigating TST (SQL automation test tool) which will faciliate database regression testing. I've been able to create a basic test case, which is below:
/*
Verification of stored proc - FOH_Status
Returns online availabity status for specified date
*/
/****** Object: StoredProcedure [dbo].[SQLTest_Status] Script Date: 11/23/2011 16:56:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE dbo.SQLTest_Status
AS
BEGIN
---CREATE A TEMP TABLE
CREATE TABLE #ControlValue (
ControlMode TINYINT
)
INSERT INTO #ControlValue EXEC dbo.Status 17254, 3 ,'2011-11-20 00:00:00'
DECLARE @CONTROL TINYINT
SET @CONTROL = (SELECT TOP 1* FROM #ControlValue)
EXEC TST.Assert.Equals 'ControlMode enabled for specified date', 1, @CONTRO
END
GO
I then proceed to link to our QA SQL server, which was successful. Then modified the stored procedure to call a stored procedure on the QA SQL server:
INSERT INTO #ControlValue EXEC [X.X.X.X].databasename.dbo.Status 17254, 3 ,'2011-11-20 00:00:00'
Upon running the test from TST runner will fail with DTC transaction fail message:
OLE DB provider "SQLNCLI10" for linked server "X.X.X.X" returned message "The transaction manager has disabled its support for remote/network transactions.".
Error: 7391, The operation could not be performed because OLE DB provider "SQLNCLI10" for linked server "X.X.X.X" was unable to begin a distributed transaction.
I've already confirmed that MS DTC will allow remote connections, inbound and outbound calls on the QA SQL server.
In addition, run the stored procedure in query window and returns the correct result set
EXEC [X.X.X.X].databasename.dbo.Status 17254, 3 ,'2011-11-20 00:00:00'
Any ideas as to how rectify this issue?
Should I be modifying the querying to include transaction, since the returned error includes the 'was unable to begin a distributed transaction'