Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Test Explorer error: An exception occurred while initializing the database. See the InnerException for details

I am using visual studio 2013. I have two branches.

Test explorer works fine on branch A but does not on Branch B. I get the following error in the test output window:

------ Discover test started ------
**An exception occurred while initializing the database. See the InnerException for details.**
========== Discover test finished: 4530 found (0:00:07.34) ==========

As you can see, It seems to discover the tests but will not populate the test explorer window.

What database does it use? is there a project specific cache I could remove?

I use resharper so tried turning its unit test engine off but that did not help. I have done rebuilds cleans etc. to no avail.

I recently installed VS 2015 but am not yet using it? could this be an issue?

Any help would be greatly appreciated.

like image 407
Maurice Avatar asked Oct 27 '15 16:10

Maurice


2 Answers

I too had this issue today, to resolve it I did the following:

  1. Close Visual Studio 2015 and open Visual Studio 2013
  2. Click Tools > Options > Database Tools > Data Connections and change the SQL Server Instance Name to (LocalDb)\MSSQLLocalDB
  3. Close Visual Studio 2013
  4. Open Task Manager and end all SQL Server Windows NT - 64 bit processes
  5. Use Windows Explorer to navigate to the location of your solution and find the folder called TestResults
  6. Delete all folders and files from this folder including the Tests.mdf files
  7. Open Visual Studio 2013, build your solution and your tests should discover and run

Hope this helps :)

like image 130
MissProgrammer Avatar answered Oct 22 '22 00:10

MissProgrammer


It turns out it is a compatibility issue with Visual Studio 2015.. I uninstalled it and everything works fine.

like image 20
Maurice Avatar answered Oct 22 '22 01:10

Maurice