Change in Database Unit Testing RAISERROR Behavior in CTP 7

We have changed the behavior of the usage of the RAISERROR command in database unit tests. Prior to CTP7, a RAISERROR statement of any severity greater than 0 would cause the database unit test to fail. We have changed this behavior based on feedback such that the database unit test will only fail if the RAISERROR severity is 11 or greater.

This did not conform with how the industry uses RAISERROR - i.e. a RAISERROR of less that 11 does not fail the transaction and processing continues on the server.

 

So, to update your database unit tests, simply change the RAISERROR statement to have a higher severity as shown below:

 

Original Code

RAISERROR('Fail test',1,1)

 

Updated Code

 

RAISERROR('Fail test',11,1)

 

Sachin Rekhi