简体   繁体   中英

visual studio 2012 MSTest.exe cannot load ADO.NET provider SQLite & NHibernate

I have some tests that use NHibernate and SQLite to test in-memory my database components. The tests run fine in visual studio, however the MSTest.exe console runner refuse to run all my tests. The console runner is used by the Build Server that uses TeamCity to run all the tests, and I use the MSTest.exe on my machine to see that the local console runner also fails.

I have this inner exception :

NHibernate.HibernateException: Could not create the driver fromNHibernate.Driver.SQLite20Driver, NHibernate, Version=3.3.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: Unable to find the requested .Net Framework Data Provider.  It may not be installed

Most answsers to this include adding to App.config the correct reference assembly to sqlite, however the test project is a class library.

On my test project I have referenced the following assemblies :

  • NHibernate 3.3.1.4000
  • System.Data.SQLite (x86, x64) 1.0.89.0
  • Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll 10.0.0.0 (C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Common7\\IDE\\ReferenceAssemblies\\v4.0\\, I changed the default reference that pointed to the v2.0 folder and wouldn't run the tests on the build server because of the following error, though it would still run fine in visual studio :

ClassInitialize has wrong signature. Parameter 1 should be of type Microsoft.VisualStudio.TestTools.UnitTesting.TestContext

I use the following tools :

  • MSTest.exe (C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Common7\\IDE\\MSTest.exe)
  • .NET Framework 4.0
  • Visual Studio 2012

Any idea how to proceed on this? Thanks !

Ok so finally I use the vstest.console.exe console runner to execute tests, and it works. (No idea what went wrong in there) If you're interested in coupling this runner with Teamcity, there's a good read : http://blog.dontpaniclabs.com/post/2013/06/13/TeamCity-Builds-with-the-Visual-Studio-2012-Test-Runner

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM