我有一些测试使用NHibernate和SQLite来测试内存中的数据库组件 . 测试工作室中的测试运行良好,但是MSTest.exe控制台运行器拒绝运行我的所有测试 . 控制器运行程序由使用TeamCity运行所有测试的Build Server使用,我在我的机器上使用MSTest.exe来查看本地控制台运行程序也失败 .
我有这个内在的例外:
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
大多数回答者包括向App.config添加正确的引用程序集到sqlite,但是测试项目是一个类库 .
在我的测试项目中,我引用了以下程序集:
-
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 \,我更改了指向v2的默认引用 . 0文件夹,并不会在构建服务器上运行测试,因为以下错误,虽然它仍然可以在Visual Studio中正常运行:
ClassInitialize有错误的签名 . 参数1应为Microsoft.VisualStudio.TestTools.UnitTesting.TestContext类型
我使用以下工具:
-
MSTest.exe(C:\ Program Files(x86)\ Microsoft Visual Studio 11.0 \ Common7 \ IDE \ MSTest.exe)
-
.NET Framework 4.0
-
Visual Studio 2012
知道如何继续这个吗?谢谢 !
1 回答
好的,最后我使用vstest.console.exe控制台运行程序来执行测试,并且它可以工作 . (不知道那里出了什么问题)如果你读得很好:http://blog.dontpaniclabs.com/post/2013/06/13/TeamCity-Builds-with-the-Visual-Studio-2012-Test-Runner