Whenever I use ExpectException I receive the following error: (There was also a ROLLBACK ERROR --> The current transaction cannot be committed and cannot be rolled back to a savepoint. Roll back the entire transaction.{Private_RunTest,140})
It appears that tSQLt is attempting a ROLLBACK after the fact that MSSQL has already performed the ROLLBACK due to the RAISERROR.
I wrapped the following SELECT and SET statement in Private_RunTest with the following IF statement and it appeared to resolve the problem.
IF ISNULL(@ExpectException,0) <> 1
BEGIN
SELECT @Msg = COALESCE(@Msg, '<NULL>') + ' (There was also a ROLLBACK ERROR --> ' +
COALESCE(ERROR_MESSAGE(), '<ERROR_MESSAGE() is="" NULL="">') + '{' +
COALESCE(ERROR_PROCEDURE(), '<ERROR_PROCEDURE() is="" NULL="">') + ',' +
COALESCE(CAST(ERROR_LINE() AS NVARCHAR), '<ERROR_LINE() is="" NULL="">') + '})';
SET @Result = 'Error';
END
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Whenever I use ExpectException I receive the following error: (There was
also a ROLLBACK ERROR --> The current transaction cannot be committed and
cannot be rolled back to a savepoint. Roll back the entire
transaction.{Private_RunTest,140})
It appears that tSQLt is attempting a ROLLBACK after the fact that MSSQL
has already performed the ROLLBACK due to the RAISERROR.
I wrapped the following SELECT and SET statement in Private_RunTest with
the following IF statement and it appeared to resolve the problem.
IF ISNULL(@ExpectException,0) <> 1
BEGIN
SELECT @Msg = COALESCE(@Msg, '') + ' (There was also a ROLLBACK ERROR -->
' +
COALESCE(ERROR_MESSAGE(), '') + '{' +
COALESCE(ERROR_PROCEDURE(), '') + ',' +
COALESCE(CAST(ERROR_LINE() AS NVARCHAR), '') + '})';
SET @Result = 'Error';
END
Whenever I use ExpectException I receive the following error: (There was also a ROLLBACK ERROR --> The current transaction cannot be committed and cannot be rolled back to a savepoint. Roll back the entire transaction.{Private_RunTest,140})
It appears that tSQLt is attempting a ROLLBACK after the fact that MSSQL has already performed the ROLLBACK due to the RAISERROR.
I wrapped the following SELECT and SET statement in Private_RunTest with the following IF statement and it appeared to resolve the problem.
IF ISNULL(@ExpectException,0) <> 1
BEGIN
SELECT @Msg = COALESCE(@Msg, '<NULL>') + ' (There was also a ROLLBACK ERROR --> ' +
COALESCE(ERROR_MESSAGE(), '<ERROR_MESSAGE() is="" NULL="">') + '{' +
COALESCE(ERROR_PROCEDURE(), '<ERROR_PROCEDURE() is="" NULL="">') + ',' +
COALESCE(CAST(ERROR_LINE() AS NVARCHAR), '<ERROR_LINE() is="" NULL="">') + '})';
SET @Result = 'Error';
END
Hi Scott,
I saw that you also posted on stack overflow and added a comment there:
http://stackoverflow.com/questions/23876571/tsqlt-there-was-also-a-rollback-error-in-private-runtest
It would be helpful to see more details of your test and the code you are
testing.
Thanks,
Dennis
On Mon, May 26, 2014 at 3:22 PM, Scott Heringer
scottheringer@users.sf.netwrote: