DAAB Unit tests fail when not using SQL Express

Topics: Data Access Application Block
Aug 29, 2007 at 6:37 PM
I have installed the Northwind database by running the instnwnd.sql script because I can't get SQLExpress to install on my machine as opposed to running the CreateNorthWindDb.cmd script. When I attempt to run the unit tests from the test manager using a filter on Namespace and project to get a subset for the Microsoft.Practices.EnterpriseLibrary.Data.Sql.Tests namespace or Microsoft.Practices.EnterpriseLibrary.Data.Oracle.Tests I get failed tests from invalid operation/row counts. Database initialization problems. When I try to execute all of the unit test in Data.VSTS1.vsdmi the VSTest.Host.exe process crashes.

Are all of these Northwind initialization problems due to A: Northwind not being a SQLExpress database or B: not being able to run the entire test suite in order. The test seem to be very order/initialization dependent.

I am using the Aprill 2007 release of the EntLib
I am currently using SQL Server to host Northwind not SQLExpress so all Data.VSTS.sln connection string references to server=(local)\SQLEXPRESS have been changed to server=(local) in Microsoft.Practices.EnterpriseLibrary.Data.Tests.dll.config as well as in the source code (unit test should get this from config but some instances they don't). If I get some confirmation that running the test without SQLExpress could cause all of these initialization errors I will attempt again to install SQLExpress (test execute in individual SQLExpress instances possibly?)

I'm going to get SQLExrpress installed I executed unit test on co-workers computer that had SQL Express installed. All but two of the test in the Data.Sql.Tests namespace executed.

Can any one point me to the database installation instructions for Northwind to support the DAAB?
Aug 29, 2007 at 6:58 PM

The Northwind data is really standard and differences between SQL and SQL express are unlikely, so it's more likely there is an issue with the order of execution. That would explain failures because of row counts but not invalid operation errors, though. Do you get these errors consistently? In which tests? Try executing them sorted by full class name to see if the behavior is consistent.

You can get the Northwind data from MS (http://www.microsoft.com/downloads/details.aspx?FamilyID=06616212-0356-46A0-8DA2-EEBC53A68034&displaylang=en) but it should be the same as the script bundled with EntLib.

Sep 7, 2007 at 7:09 PM
I did a test I dropped my Northwind database created from Northwind.sql included in the ent lib installation directory and recreated it ran the unit tests again and still get initialization errors (invalid row counts etc). I got SQLExpress installed and ran the CreateNorthWindDB.cmd from the ent lib installation. All of the initialization errors went away. Something is different.
Sep 7, 2007 at 8:46 PM

Can you characterize the failures? Please post the failure details (e.g. number of failed tests, name of the failed tests, etc).

Sep 7, 2007 at 9:59 PM
I did not capture the errors but they are very close to the ones posted here:

Another issue I logged about initialization errors using the Oracle unit tests of the DAAB
Sep 25, 2007 at 5:57 PM
Hi Sarr,

I ran the DAAB unit tests on a new machine where I installed VSTS and SQL Server 2005. Initialized the Northwind database and registered instrumentation. All tests passed for me except for one requiring MSDTC to be installed.

Can you please try again with your SQL server and post the failures? Include the full class name in the log, as some class names are duplicated in different namespaces.