开发者

ReSharper doesn't see my Machine.Specification tests

开发者 https://www.devze.com 2022-12-08 08:17 出处:网络
I\'m having a problem getting ReSharper to see the Machine.Specification \"tests\" I\'ve written. The s开发者_运维问答pecs run in the ConsoleRunner from mSpec. When I try to \"Run Unit Tests\" in ReS

I'm having a problem getting ReSharper to see the Machine.Specification "tests" I've written.

The s开发者_运维问答pecs run in the ConsoleRunner from mSpec. When I try to "Run Unit Tests" in ReSharper, I get a message: "No tests found in file." The specs don't show the test markers.

I created a folder in the ReSharper /bin/ folder and put the proper .dlls there. The mSpec plug in appears in ReSharper.

What might I be missing?

Also, I'm using xUnit.NET if that makes a difference.


The ReSharper runner do not take nested context classes into account. Instead of nesting context classes:

namespace SomeNamespace
{
    public class Specs
    {
        public class when_something_happens
        {
            Because of = () => {};
            It should_do_something = () => {};
        }
    }
}

Author contexts that are not nested, i.e. root classes inside a namespace:

namespace SomeNamespace
{
    public class when_something_happens
    {
        Because of = () => {};
        It should_do_something = () => {};
    }
}

ReSharper's green-and-yellow test icons do appear if all of the conditions are met:

  • class is public
  • class is not abstract
  • class is not nested
  • has >= 1 specification field (It), or has >= 1 behavior field (Behaves_like<>)


In order to have good integration of MSpec with Visual Studio and ReSharper install MSpec using installer which is available here: http://marcinobel.com/index.php/mspec-bdd-installer/


Had also the same problem with "No tests found in file" when try to use ReSharper and XUnit.net together. However I could see my tests in Test Explorer window and was able to run them from there.

0

精彩评论

暂无评论...
验证码 换一张
取 消