Я пытаюсь запустить dotcover с NUnit.Console-3.9.0 \ nunit3-console-runner.exe в качестве целевого исполняемого файла.
Прикрепленный код и скриншоты моей работы.
using System;
namespace secondApp
{
public class Class1
{
public int add(int a, int b)
{
return a + b;
}
public int sub(int a, int b)
{
return a - b;
}
}
}
Это соответствующий тестовый файл.
using NUnit.Framework;
using secondApp;
namespace Tests
{
public class Tests
{
private Class1 class1;
[SetUp]
public void Setup()
{
class1 = new Class1();
}
[Test]
public void AddTest1()
{
int val = class1.add(1, 2);
Assert.AreEqual(val, 3);
}
[Test]
public void SubTest()
{
int val = class1.sub(1, 2);
Assert.AreEqual(val, -1);
}
}
}
Это файл file_coverage.xml (dotcover c file_coverage.xml), здесь происходит ошибка
<?xml version="1.0" encoding="utf-8"?>
<AnalyseParams>
<TargetExecutable>..\3rdparty\NUnit.Console-3.9.0\nunit3-console.exe
</TargetExecutable>
<TargetArguments>.\Testfile.nunit</TargetArguments>
<Output>output.dcvr</Output>
<Filters>
<IncludeFilters>
<FilterEntry>
<ModuleMask>*</ModuleMask>
<ClassMask>*</ClassMask>
<FunctionMask>*</FunctionMask>
</FilterEntry>
</IncludeFilters>
</Filters>
</AnalyseParams>
это Testfile.nunit
<NUnitProject>
<Settings activeconfig="Debug" />
<Config name="Debug" binpathtype="Auto">
<assembly path=".\bin\Debug\netcoreapp2.1\Test.dll" />
</Config>
</NUnitProject>
Это ошибка
dotcover c file_coverage.xml
JetBrains dotCover Console Runner 2018.2.3. Build 777.0.20180912.160624
Copyright (c) 2009-2019 JetBrains s.r.o. All rights reserved.
[JetBrains dotCover] Coverage session started [1/8/2019 12:19:36 PM]
NUnit Console Runner 3.8.0
Copyright (c) 2018 Charlie Poole, Rob Prouse
Runtime Environment
OS Version: Microsoft Windows NT 10.0.16299.0
CLR Version: 4.0.30319.42000
Test Files
c:\rough-work\secondApp\Test\Testfile.nunit
Errors, Failures and Warnings
1) Error : c:\rough-work\secondApp\Test\Testfile.nunit
NUnit.Engine.NUnitEngineException : An exception occurred in the driver while loading tests.
----> System.IO.FileNotFoundException : Could not load file or assembly 'nunit.framework' or one of its dependencies. The system cannot find the file specified.
--NUnitEngineException
Server stack trace:
at NUnit.Engine.Runners.DirectTestRunner.LoadDriver(IFrameworkDriver driver, String testFile, TestPackage subPackage)
at NUnit.Engine.Runners.DirectTestRunner.LoadPackage()
at NUnit.Engine.Runners.TestDomainRunner.LoadPackage()
at NUnit.Engine.Runners.DirectTestRunner.EnsurePackageIsLoaded()
at NUnit.Engine.Runners.DirectTestRunner.RunTests(ITestEventListener listener, TestFilter filter)
at NUnit.Engine.Runners.AbstractTestRunner.Run(ITestEventListener listener, TestFilter filter)
at NUnit.Engine.Agents.RemoteTestAgent.Run(ITestEventListener listener, TestFilter filter)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at NUnit.Engine.ITestEngineRunner.Run(ITestEventListener listener, TestFilter filter)
at NUnit.Engine.Runners.ProcessRunner.RunTests(ITestEventListener listener, TestFilter filter)
--FileNotFoundException
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Activator.CreateInstance(String assemblyString, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)
at System.AppDomain.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
at NUnit.Engine.Drivers.NUnit3FrameworkDriver.CreateObject(String typeName, Object[] args)
at NUnit.Engine.Drivers.NUnit3FrameworkDriver.Load(String testAssemblyPath, IDictionary`2 settings)
at NUnit.Engine.Runners.DirectTestRunner.LoadDriver(IFrameworkDriver driver, String testFile, TestPackage subPackage)
Test Run Summary
Overall result: Failed
Test Count: 0, Passed: 0, Failed: 0, Warnings: 0, Inconclusive: 0, Skipped: 0
Start time: 2019-01-08 06:49:38Z
End time: 2019-01-08 06:49:38Z
Duration: 0.603 seconds
Results (nunit3) saved as TestResult.xml
[JetBrains dotCover] Coverage session finished [1/8/2019 12:19:40 PM]
[JetBrains dotCover] Analyzed application exited with code '-100'
[JetBrains dotCover] Coverage results post-processing started [1/8/2019 12:19:40 PM]
[JetBrains dotCover] Coverage results post-processing finished [1/8/2019 12:19:40 PM]