Visual Studio 2012 Adapter Support #110

jcdickinson opened this Issue Jul 10, 2012 · 13 comments


None yet
7 participants

Include Visual Studio 2012 support.

I don't have the time to go through a pull request or such, but I did write the starting point:

  • Machine.Specifications.VisualStudioSupport on GDrive
  • The build needs to go into C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\Extensions (including Machine.Specifications.dll, as far as I know)
  • When an MSpec project is in your solution the specs will be picked up automatically.

Use it, don't use it :). Some stuff:

  • The AppDomain runner is basically pointless because it takes Assembly objects as parameters. This means that they are loaded into the primary domain and remain locked. This causes issues in Visual Studio because it keeps test runners running in the background (so any subsequent builds fail). I worked around this by doing most of the work for each call in a different AppDomain.
  • The DiaSession needs a method name - where MSpec uses fields. I worked around this by getting the Delegate from the field (if it is a Delegate) and then retrieving the symbol for the bound MethodInfo on that. This is required for "double click test and go to it from the Unit Test Explorer" functionality.
  • There is some prettifying of the output that makes more sense in VS terms.
  • My "system name" for tests absolutely sucks - but looks like it should be unique (as it uses CLR reserved characters), maybe you can come up with a better one (you will need to check both the Discoverer and Executor). Type Name::Field Name;Assembly Path
  • It seems to be 100% done at the moment with the exception of the VSIX stuff. I am sure you could just take a peek at the xUnit codebase to see how they do it.
  • There are no unit tests. I just did this for myself. I'm just sharing the code.


Does this allow the use of MSFakes in MSpec tests run in the VS2012 runner?

MSpecs, yes, MSFakes hasn't been tested.

Very nice.

(edit, I now see the zip - it seems to be just testrunner code for VS2012 and not modifying any MSpec code).

Did you modify any MSpec code in the package you included? Just want to make sure your code was independent of the MSpec assemblies themselves.

Exactly: no MSpec code was changed.

When you say it "seems to be 100% done at the moment with the exception of the VSIX stuff", what "VSIX stuff" are you referring to? I understand the idea of VSIX, but where do you see it being used in this solution?

I meant the "Visual Studio Gallery" installation (making a .vsix file) - so currently it's a manual install or build.


ivanz commented Sep 24, 2012

@jcdickinson Would be good if you can put up the code on GitHub, etc. I am interested to have a play around and I am sure it's going to make it easier for others to contribute to.

Would be awesome if somebody could finish this. We're stuck with MSTest (and never needed anything else anyway), but I really dig MSpec




agross commented Dec 12, 2012

Closing the issue because there's a runner available now.

agross closed this Dec 12, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment