machine / machine.specifications

Machine.Specifications is a Context/Specification framework for .NET that removes language noise and simplifies tests.
MIT License
885 stars 178 forks source link

Cannot run tests in VS2019 #417

Closed 03l54rd1n3 closed 4 years ago

03l54rd1n3 commented 4 years ago

Hi,

we struggle to get MSpec tests running with the VS 2019 Test Explorer. We have the MSpec Nuget packages in a dedicated Test project and also the VisualStudio.Runner package. The runner extension doesn't seem to be installable for 2019, btw.

When executing tests, we get the following error:

---------- Starting test run ----------
Multiple versions of same extension found. Selecting the highest version.
  Machine.TestAdapter : 2.10.1
Machine Specifications Visual Studio Test Adapter - Executing Test Specifications.
Machine Specifications Visual Studio Test Adapter - Filter property set ''
Machine Specifications Visual Studio Test Adapter - Executing 1 tests in 'C:\path\to\project\Specs.dll'.
Machine Specifications Visual Studio Test Adapter - Error while executing specifications in assembly 'C:\path\to\project\Specs.dll'.
System.MissingMethodException: Method not found: 'Void Machine.Specifications.Runner.Impl.DefaultRunner.RunType(System.Reflection.Assembly, System.Type, System.Collections.Generic.IEnumerable`1<System.String>)'.

Server stack trace: 
   at Machine.VSTestAdapter.Execution.TestExecutor.RunTestsInAssembly(String pathToAssembly, IEnumerable`1 specsToRun, ISpecificationRunListener specificationRunListener)
   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 Machine.VSTestAdapter.Execution.TestExecutor.RunTestsInAssembly(String pathToAssembly, IEnumerable`1 specsToRun, ISpecificationRunListener specificationRunListener)
   at Machine.VSTestAdapter.Execution.SpecificationExecutor.RunAssemblySpecifications(String assemblyPath, IEnumerable`1 specifications, Settings settings, Uri adapterUri, IFrameworkHandle frameworkHandle)
   at Machine.VSTestAdapter.MSpecTestAdapterExecutor.RunTests(IEnumerable`1 tests, IRunContext runContext, IFrameworkHandle frameworkHandle)
========== Test run finished: 0 Tests run in 2,2 sec (0 Passed, 0 Failed, 0 Skipped) ==========
robertcoltheart commented 4 years ago

Can you give me more information? For instance, are you using new-style csproj syntax, which framework are you targeting, etc. Also which version of the Machine.Specifications library are you referencing?

A zipped sample project would help if you can re-create the issue.

03l54rd1n3 commented 4 years ago

Hi, we are targeting .NET framework 4.7.2 with the old csproj format. And these are the versions of Machine.Specifications we have:

image

robertcoltheart commented 4 years ago

So my first suggestion would be to update your packages, specifically the Machine.Specifications package. It's an extremely old version and the execution code has changed from 0.10.0 onwards I believe.

robertcoltheart commented 4 years ago

I'm going to close this as I assume the package updates will do the trick.

03l54rd1n3 commented 4 years ago

Hi, yeah go ahead and close this. Thank you. We'll have a meeting in our company to discuss whether we are going to update this, as it is quite extensive.