Using ChromiumWebBrowser within NUnit tests?

-1

Has anyone managed to do this?

I get the following exception:

System.IO.FileNotFoundException
  HResult=0x80070002
  Message=Could not load file or assembly 'CefSharp, Version=71.0.2.0, Culture=neutral, PublicKeyToken=40c4b6fc221f4138' or one of its dependencies. The system cannot find the file specified.
  Source=<Cannot evaluate the exception source>
  StackTrace:
<Cannot evaluate the exception stack trace>

This is my project structure:

enter image description here

This is my test code:

using CefSharp.WinForms;
using NUnit.Framework;

namespace ChromiumNUnit
{
    [TestFixture]
    public class ChromiumNUnitTests
    {
        [Test]
        public void InstantiateBrowser()
        {
            ChromiumWebBrowser browser = new ChromiumWebBrowser(null);
        }
    }
}

NUnit and CefSharp.WinForms are both included as NuGet packages. All of the required binaries appear to exist in the output directory.

Debug output here:

'ReSharperTestRunner64.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'JetLauncherIL'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: Domain 2): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: Entryway): Loaded 'C:\Users\dylan.towler\AppData\Local\JetBrains\Installations\ReSharperPlatformVs15_646c3fca_000\JetBrains.ReSharper.TaskRunnerFramework.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: Entryway): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: Entryway): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: Entryway): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: Entryway): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: Entryway): Loaded 'C:\Users\dylan.towler\AppData\Local\JetBrains\Installations\ReSharperPlatformVs15_646c3fca_000\JetBrains.ReSharper.UnitTestRunner.nUnit.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: Entryway): Loaded 'C:\Users\dylan.towler\AppData\Local\JetBrains\Installations\ReSharperPlatformVs15_646c3fca_000\JetBrains.ReSharper.UnitTestRunner.nUnit30.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: Domain 3): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: Tests: ChromiumNUnit): Loaded 'C:\Users\dylan.towler\AppData\Local\JetBrains\Installations\ReSharperPlatformVs15_646c3fca_000\JetBrains.ReSharper.TaskRunnerFramework.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: Tests: ChromiumNUnit): Loaded 'C:\Users\dylan.towler\AppData\Local\JetBrains\Installations\ReSharperPlatformVs15_646c3fca_000\JetBrains.ReSharper.UnitTestRunner.nUnit30.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: Tests: ChromiumNUnit): Loaded 'C:\Users\dylan.towler\AppData\Local\JetBrains\Installations\ReSharperPlatformVs15_646c3fca_000\JetBrains.ReSharper.UnitTestRunner.nUnit.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: Tests: ChromiumNUnit): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: Tests: ChromiumNUnit): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: Tests: ChromiumNUnit): Loaded 'C:\Users\dylan.towler\AppData\Local\JetBrains\Installations\ReSharperPlatformVs15_646c3fca_000\nunit3\nunit.engine.api.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: Tests: ChromiumNUnit): Loaded 'C:\Users\dylan.towler\AppData\Local\JetBrains\Installations\ReSharperPlatformVs15_646c3fca_000\nunit3\Mono.Cecil.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: Tests: ChromiumNUnit): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: Tests: ChromiumNUnit): Loaded 'C:\Users\dylan.towler\AppData\Local\JetBrains\Installations\ReSharperPlatformVs15_646c3fca_000\nunit3\nunit.engine.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: Tests: ChromiumNUnit): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_64\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: Tests: ChromiumNUnit): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Remoting\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Remoting.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: Tests: ChromiumNUnit): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: Tests: ChromiumNUnit): Loaded 'C:\Git\ChromiumNUnit\ChromiumNUnit\bin\x64\Debug\nunit.framework.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: Tests: ChromiumNUnit): Loaded 'C:\Users\dylan.towler\AppData\Local\JetBrains\Installations\ReSharperPlatformVs15_646c3fca_000\nunit3\Castle.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: Tests: ChromiumNUnit): Loaded 'C:\Git\ChromiumNUnit\ChromiumNUnit\bin\x64\Debug\ChromiumNUnit.dll'. Symbols loaded.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: Tests: ChromiumNUnit): Loaded 'C:\Git\ChromiumNUnit\ChromiumNUnit\bin\x64\Debug\CefSharp.WinForms.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: Tests: ChromiumNUnit): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089\System.Windows.Forms.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: Tests: ChromiumNUnit): Loaded 'C:\Git\ChromiumNUnit\ChromiumNUnit\bin\x64\Debug\CefSharp.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: Tests: ChromiumNUnit): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: Tests: ChromiumNUnit): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\Accessibility\v4.0_4.0.0.0__b03f5f7f11d50a3a\Accessibility.dll'. Cannot find or open the PDB file.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: Tests: ChromiumNUnit): Loaded 'C:\Git\ChromiumNUnit\ChromiumNUnit\bin\x64\Debug\CefSharp.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ReSharperTestRunner64.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Git\ChromiumNUnit\ChromiumNUnit\bin\x64\Debug\CefSharp.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module.
Could not load file or assembly 'CefSharp, Version=71.0.2.0, Culture=neutral, PublicKeyToken=40c4b6fc221f4138' or one of its dependencies. The system cannot find the file specified.
c#
.net
nunit
chromium
cefsharp
asked on Stack Overflow Mar 25, 2019 by Dylan

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0