Search code examples
sql-serverunit-testingsql-server-data-tools

SSDT: Scalar Value - Check if a Cell is Empty


I've just created a new Test Project in Visual Studio and added an SQL Server Unit Test. Now I've created my TSQL and added a "Scalar Value" Test Condition. Everything works fine, when I expect a string. But there are some cells which contains 'empty' - how can I set the expected value in the test condition, that I can check this 'empty' cells?

I tryed to leave the expected value empty as well, but that results in following error-message: "ScalarValueCondition Condition (scalarValueCondition6) Failed: ResultSet 1 Row 6 Column 1: values do not match, actual '' expected ''.

Thanks in advance!

Immi


Solution

  • This appears to be a defect in the DB unit test Scalar Value condition. Sorry about that. Would you mind filing a Connect bug for this at https://connect.microsoft.com/SQLServer/feedback/CreateFeedback.aspx using the category "Developer Tools (SSDT, BIDS, etc.)"?

    I'd suggest working around this by using the Data Checksum condition instead. I checked and it correctly distinguishes between null and ''. It takes a little more effort to configure, because you'll have to execute the query to gather the baseline checksum value, and it's a little less clear what the test is expecting.