0
votes

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 !

1

1 Answers

0
votes

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