Build/Test Issues

NCurnch does not recognize MSpec tests with Behavior when Behavior is defined in a separate assembly

Started by User1 on 4,558 views

If SomeBehavior is defined in a different assembly then the test itself. In this case, the the spec containing Behaves_like member does not seem to be recognized by NCrunch. The spec is not on the list of executed tests, coverage markers stay white.


[Subject(typeof(X))]
public class when_X {

Establish context = () => {
// some init code
};

#pragma warning disable 0169
Behaves_like<SomeBehavior> behaves_as_expected;
#pragma warning restore 0169
}



NCrunch 2.19.0.4.
Visual Studio Professional 2015
.NET 4.6 project
MSpec is latest: https://www.nuget.org/packages/Machine.Specifications-Signed/0.9.3


The same exact test is recognized by ReSharper.

Edited

Hi,

Thanks for sharing this problem. This looks to be an issue with the static analysis. I've noted it down for review.

To work around the problem, change the 'Framework utilisation type for MSpec' solution-level configuration option to 'DynamicAnalysis'.

Post a reply

Log in to reply.