3

在尝试将单元测试添加到我当前的项目时,我遇到了 Visual Studio 2012 和 2013 的Google Test Runner插件。但是,当我尝试使用它运行测试时,我遇到了以下错误:

------ Run test started ------
Found 2 tests, resolving symbols
Loading symbols from C:\Users\MYUSER\Documents\Visual Studio 2013\Projects\MY PROJECT\Debug\tests.exe
Retrieving the COM class factory for component with CLSID {BCE36434-2C24-499E-BF49-8BD99B0EEB68} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
Running: C:\Users\MYUSER\Documents\Visual Studio 2013\Projects\MY PROJECT\Debug\tests.exe --gtest_output=xml:C:\Users\MYUSER\AppData\Local\Temp\tmpB2DE.tmp 
Opened results from C:\Users\MYUSER\AppData\Local\Temp\tmpB2DE.tmp
Could not load file or assembly 'FSharp.Core, Version=4.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
   at FSharp.Data.RuntimeImplementation.XmlOperations.GetChildrenArray(XmlElement value, String nameWithNS)
   at FSharp.Data.RuntimeImplementation.XmlOperations.ConvertArray[R](XmlElement xml, String nameWithNS, Func`2 f)
   at GoogleTestRunner.ResultParser.getResults(IMessageLogger logger, String outputPath, IEnumerable`1 testCases)
   at GoogleTestRunner.GoogleTestExecutor.runOnce(IFrameworkHandle framework, Boolean debug, FSharpList`1 cases, String executable, Boolean runAll)
   at GoogleTestRunner.GoogleTestExecutor.runTests(IEnumerable`1 tests, IRunContext runContext, IFrameworkHandle framework, Boolean runAll)
No test is available in C:\Users\MYUSER\Documents\Visual Studio 2013\Projects\MY PROJECT\Debug\tests.exe. Make sure that installed test discoverers & executors, platform & framework version settings are appropriate and try again.
========== Run test finished: 0 run (0:00:04.7380291) ==========

我不知道 F# 并且看不出是什么问题导致了这个问题或如何解决它,页面说它与 Visual Studio 2013 兼容。测试在文本资源管理器中正确发现和查看,但不运行。

编辑: 有时在构建后我得到这个:

------ Discover test started ------
GoogleTest: Does C:\Users\MYUSER\Documents\Visual Studio 2013\Projects\MY PROJECT\Debug\MY PROJECT.exe match [Tt]est[s]{0,1}.exe: false
GoogleTest: Does C:\Users\MYUSER\Documents\Visual Studio 2013\Projects\MY PROJECT\Debug\Tests.exe match [Tt]est[s]{0,1}.exe: true
Found 2 tests, resolving symbols
Loading symbols from C:\Users\MYUSER\Documents\Visual Studio 2013\Projects\MY PROJECT\Debug\Tests.exe
Retrieving the COM class factory for component with CLSID {BCE36434-2C24-499E-BF49-8BD99B0EEB68} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
GoogleTest: Does C:\Users\MYUSER\Documents\Visual Studio 2013\Projects\MY PROJECT\Debug\WorldServer.exe match [Tt]est[s]{0,1}.exe: false
========== Discover test finished: 2 found (0:00:00.2372256) ==========
4

2 回答 2

3

尝试安装这个 NuGet 包:

http://www.nuget.org/packages/FSharp.Core.3/

我认为您只需要 F# 运行时。

编辑:根据 Layl Conway,这是允许 Google Test Runner 运行的实际需要:

适用于 Web 的 Visual Studio Express 2012 的 F# 工具

EDIT2:为了完整起见,还有这篇博文(来自另一个SO问题的答案):

http://www.heartysoft.com/build-fsharp-3-on-build-server-without-vs

对于不耐烦的人:

单击直接下载链接( 如果您太忙,请点击http://go.microsoft.com/fwlink/?LinkId=261286 )下载 VWD_FSharp.msi,它只有 7.55MB,不包括 Azure 工具、VS 和所有其他的东西。建立工作,宇宙再次正确。

于 2013-08-30T14:29:04.953 回答
0

FSharp.Core,版本=4.3.0.0

那是 VS2012 和 F# 3.0 中包含的版本。带有 F# 3.1 的 VS2013 具有 FSharp.Core V4.3.1.0。

确保将 F# 项目的项目设置设置为使用正确且一致的 F# 运行时版本。

于 2013-08-28T19:41:44.980 回答