我正在尝试在 OffScreen 模式下使用 MsTest 单元测试框架中的 ChromiumWebBrowser 来提供一些测试......但是 Chromium 构造函数一直崩溃,我对此无能为力。
我已经在 github 上的类似帖子中留下了评论:
我也试图在 gitter 频道上寻求帮助。我创建了 MsTest 项目并添加了使用 Chromium 的简单方法:
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using CefSharp;
using CefSharp.OffScreen;
using System.Threading;
namespace ChromTests
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
ChromiumWebBrowser browser = null;
// Create the offscreen Chromium browser.
using (browser = new ChromiumWebBrowser("http://google.com"))
{
}
Cef.Shutdown();
}
}
}
我的解决方案结构:
我的 testsettings 文件(将所有依赖项部署到测试引擎“TestResults...\Out 文件夹”的工作目录中):
<?xml version="1.0" encoding="UTF-8"?>
<TestSettings name="Release" id="88aeb968-8fa1-409d-95e4-4d1cb52532e2" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
<Description>These are default test settings for a local test run.</Description>
<Deployment>
<DeploymentItem filename="bin\x64\Release\natives_blob.bin" />
<DeploymentItem filename="bin\x64\Release\libcef.dll" />
<DeploymentItem filename="bin\x64\Release\cef.pak" />
<DeploymentItem filename="bin\x64\Release\CefSharp.OffScreen.xml" />
<DeploymentItem filename="bin\x64\Release\cef_200_percent.pak" />
<DeploymentItem filename="bin\x64\Release\cef_100_percent.pak" />
<DeploymentItem filename="bin\x64\Release\CefSharp.dll" />
<DeploymentItem filename="bin\x64\Release\cef_extensions.pak" />
<DeploymentItem filename="bin\x64\Release\widevinecdmadapter.dll" />
<DeploymentItem filename="bin\x64\Release\snapshot_blob.bin" />
<DeploymentItem filename="bin\x64\Release\CefSharp.BrowserSubprocess.Core.pdb" />
<DeploymentItem filename="bin\x64\Release\CefSharp.OffScreen.dll" />
<DeploymentItem filename="bin\x64\Release\CefSharp.xml" />
<DeploymentItem filename="bin\x64\Release\CefSharp.BrowserSubprocess.exe" />
<DeploymentItem filename="bin\x64\Release\CefSharp.Core.dll" />
<DeploymentItem filename="bin\x64\Release\devtools_resources.pak" />
<DeploymentItem filename="bin\x64\Release\libEGL.dll" />
<DeploymentItem filename="bin\x64\Release\CefSharp.BrowserSubprocess.Core.dll" />
<DeploymentItem filename="bin\x64\Release\CefSharp.pdb" />
<DeploymentItem filename="bin\x64\Release\CefSharp.Core.pdb" />
<DeploymentItem filename="bin\x64\Release\CefSharp.BrowserSubprocess.pdb" />
<DeploymentItem filename="bin\x64\Release\icudtl.dat" />
<DeploymentItem filename="bin\x64\Release\CefSharp.Core.xml" />
<DeploymentItem filename="bin\x64\Release\d3dcompiler_47.dll" />
<DeploymentItem filename="bin\x64\Release\chrome_elf.dll" />
<DeploymentItem filename="bin\x64\Release\libGLESv2.dll" />
<DeploymentItem filename="bin\x64\Release\CefSharp.OffScreen.pdb" />
<DeploymentItem filename="bin\x64\Release\locales\kn.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\ml.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\lt.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\et.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\da.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\cs.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\sk.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\he.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\id.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\sl.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\fr.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\lv.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\de.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\tr.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\fa.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\zh-TW.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\hr.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\ar.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\pt-BR.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\nl.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\vi.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\gu.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\hu.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\ta.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\fi.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\ms.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\sr.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\en-US.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\el.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\zh-CN.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\en-GB.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\pl.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\es.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\th.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\bg.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\pt-PT.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\it.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\te.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\fil.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\bn.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\ro.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\sw.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\hi.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\nb.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\ca.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\sv.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\uk.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\ko.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\mr.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\ja.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\es-419.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\am.pak" outputDirectory="locales\" />
<DeploymentItem filename="bin\x64\Release\locales\ru.pak" outputDirectory="locales\" />
</Deployment>
<Execution hostProcessPlatform="MSIL">
<TestTypeSpecific>
<UnitTestRunConfig testTypeId="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b">
<AssemblyResolution>
<TestDirectory useLoadContext="true" />
</AssemblyResolution>
</UnitTestRunConfig>
</TestTypeSpecific>
<AgentRule name="Execution Agents">
</AgentRule>
</Execution>
<Properties />
</TestSettings>
我从 Visual Studio 测试资源管理器运行测试并得到这样的错误:
请帮助,需要任何支持或想法...