How to run MSpec on a Visual Studio test system using Gallio?

I'm trying to run MSpec tests on a Visual Studio test system using Gallio, but it seems to be ignoring the MSpec plugin from the IDE. What I've done:

  • Installed by Gallio
  • Added MSpec NuGet package to test project
  • Gallio NuGet package added to my test project
  • I copied the three files needed to integrate MSpec Gallio into the "MSpec" folder in the Gallio installation directory.
  • Wrote test MSpec
  • Ran "All tests in solution" in the IDE

This gave the following error:

"There were no tests because the tests were not loaded or the selected tests were not disabled."

To test Gallio itself, I added a link to MbUnit and created a simple MbUnit test. I also used Gallio for other tools to check if the plugin was even plugged in. I even restarted VS for a good grade.

results

Test execution using Gallio.Echo or Gallio.Icarus successfully performs MbUnit and MSpec tests, so the plug-in is connected. Running tests from Visual Studio runs the MbUnit test, but not the MSpec test, so the Gallio integration works (and not the MSpec plugin). Any thoughts?

Before anyone mentions this: yes, I would rather use ReSharper , but licenses are not suitable for my situation at the moment.

+4
source share
1 answer

Update: Now this is a project for integrating MSpec into the VS2012 test system. It is available in the Visual Studio Gallery and the source is on GitHub .

After starting debugging problems with both sources of the project, there seem to be two main problems causing incompatibility between MSpec and the Gallio VS runner. However, both problems are related to the fact that the VS runner uses Cecil to load type information from assemblies (presumably to avoid loading the test assembly into the main VS AppDomain).

I will update this answer while I open more (I hope that one or more fixes fix the problems).

Problem 1: Nested types are ignored

I used nested types for my tests ( SubjectSpec+when_something ), which are ignored by the Cecil-based reflection used by the Gallio VS runner to avoid loading the test assembly into the application domain.

This turned out to be a fairly simple fix that I introduced as a patch to the Gallio developers. I will update this answer if / when I receive confirmation of which release it will be part of.

Problem 2: MSpec throws "An exception occurred while calling the test driver"

If the container type is removed to avoid problem 1, MSpec throws this error. The reason for this is that MSpec is trying to instantiate a test object, but Gallio provides only a Type wrapper object that cannot actually be created.

+5
source

Source: https://habr.com/ru/post/1416491/


All Articles