You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've come across an issue with the plugin when using a behavior which has a generic type parameter. When the behaviors are run, the result of it is "Inconclusive: Test not run"
As far as I can tell this is tied to the plugin and not MSpec itself, I've tested it using the command line MSpec runner and the tests fail/succeed as expected.
using Machine.Specifications;
namespace MSpecBehaviorRepro
{
public class BehaviorTest
{
public class when_using_behaviors
{
Establish context = () =>
{
_testClass = new ConcreteClass
{
AssertionValue = "Hello world!"
};
};
Behaves_like<NormalBehavior> normal_behavior;
Behaves_like<GenericBehavior<ConcreteClass>> generic_behavior;
Behaves_like<GenericBehavior<AbstractClass>> failing_generic_behavior;
}
static AbstractClass _testClass;
[Behaviors]
public class NormalBehavior
{
It should_have_an_assertion = () => _testClass.AssertionValue.ShouldEqual("Hello world!");
}
[Behaviors]
public class GenericBehavior<T> where T : AbstractClass
{
It should_have_an_assertion = () => _testClass.AssertionValue.ShouldEqual("Hello world!");
It should_be_the_correct_type = () => TestHelper.GetTypeName<T>().ShouldEqual(_testClass.GetType().Name);
}
public abstract class AbstractClass
{
public string AssertionValue { get; set; }
}
public class ConcreteClass : AbstractClass
{
}
static class TestHelper
{
public static string GetTypeName<T>()
{
return typeof(T).Name;
}
}
}
}
From visual studio:
When using the MSpec command line runner (failing as expected):
Verbose logs from the runner:
2018.04.17 12:18:36.617 INFO BuildStage started
2018.04.17 12:18:36.617 INFO Build policy: Automatic
2018.04.17 12:18:36.941 INFO 1 projects built
2018.04.17 12:18:36.941 VERBOSE MSpecBehaviorRepro
2018.04.17 12:18:36.941 INFO BuildStage completed
2018.04.17 12:18:36.946 INFO RefreshProjectPropertiesStage started
2018.04.17 12:18:36.947 INFO RefreshProjectPropertiesStage completed
2018.04.17 12:18:36.948 INFO DiscoveryStage started
2018.04.17 12:18:36.948 INFO Test exploration required for 1 projects
2018.04.17 12:18:36.948 VERBOSE MSpecBehaviorRepro
2018.04.17 12:18:36.972 INFO DiscoveryStage completed
2018.04.17 12:18:36.972 INFO BuildPipelineStage started
2018.04.17 12:18:36.972 INFO BuildPipelineStage completed
2018.04.17 12:18:36.972 INFO ApplyRulesStage started
2018.04.17 12:18:36.973 INFO Got 9 elements (0 explicit) to run
2018.04.17 12:18:36.973 VERBOSE Marking 9 elements as Pending
2018.04.17 12:18:36.974 VERBOSE Marking elements as Pending completed
2018.04.17 12:18:36.974 VERBOSE Distributing 9 elements into runs
2018.04.17 12:18:36.975 VERBOSE Distributing elements completed
2018.04.17 12:18:36.976 INFO Created 1 unit-test runs
2018.04.17 12:18:36.976 INFO ApplyRulesStage completed
2018.04.17 12:18:36.976 INFO RunTestsStage started
2018.04.17 12:18:36.976 VERBOSE Running up to 1 unit-test runs in parallel
2018.04.17 12:18:36.981 INFO Run: 902cc529-bdfe-415c-9f9c-5f113c8b5c59 - Started
2018.04.17 12:18:36.981 VERBOSE Provider: Machine.Specifications
Project: None
Target Framework: .NETFramework,Version=v4.5.2
Strategy: Machine.Specifications.ReSharperProvider.RunStrategies.MspecOutOfProcessUnitTestRunStrategy
Runtime Enviroment:
Platform Type: x64
Platform Version: v4_5
2018.04.17 12:18:36.982 INFO Starting process: C:\Users\simon.lissack\AppData\Local\JetBrains\Installations\ReSharperPlatformVs15_1cd52f3e_000\JetBrains.ReSharper.TaskRunner.CLR45.x64.exe "127.0.0.1" "22775" "902cc529-bdfe-415c-9f9c-5f113c8b5c59"
2018.04.17 12:18:36.986 INFO Started process with pid 6940
2018.04.17 12:18:37.624 WARN Run: 902cc529-bdfe-415c-9f9c-5f113c8b5c59 - Cannot find element for task <e545ac96-c38c-40e2-be7c-cf95edf89297> of type <MspecTestAssemblyTask>
2018.04.17 12:18:37.984 INFO Process C:\Users\simon.lissack\AppData\Local\JetBrains\Installations\ReSharperPlatformVs15_1cd52f3e_000\JetBrains.ReSharper.TaskRunner.CLR45.x64.exe:6940 has exited
2018.04.17 12:18:37.984 INFO Run: 902cc529-bdfe-415c-9f9c-5f113c8b5c59 - Completed
2018.04.17 12:18:37.984 INFO RunTestsStage completed
2018.04.17 12:18:37.985 INFO Finishing run
2018.04.17 12:18:37.985 WARN Element MSpecBehaviorRepro.BehaviorTest+when_using_behaviors.generic_behavior.MSpecBehaviorRepro.BehaviorTest+GenericBehavior`1.should_be_the_correct_type was left pending after its run completion.
2018.04.17 12:18:37.985 WARN Element MSpecBehaviorRepro.BehaviorTest+when_using_behaviors.generic_behavior.MSpecBehaviorRepro.BehaviorTest+GenericBehavior`1.should_have_an_assertion was left pending after its run completion.
2018.04.17 12:18:37.985 WARN Element MSpecBehaviorRepro.BehaviorTest+when_using_behaviors.failing_generic_behavior.MSpecBehaviorRepro.BehaviorTest+GenericBehavior`1.should_be_the_correct_type was left pending after its run completion.
2018.04.17 12:18:37.985 WARN Element MSpecBehaviorRepro.BehaviorTest+when_using_behaviors.failing_generic_behavior.MSpecBehaviorRepro.BehaviorTest+GenericBehavior`1.should_have_an_assertion was left pending after its run completion.
2018.04.17 12:18:37.986 INFO Run is finished
The text was updated successfully, but these errors were encountered:
Resharper version: 2017.3
Visual Studio version: 2017/2015
MSpec runner version: 2.0.2
I've come across an issue with the plugin when using a behavior which has a generic type parameter. When the behaviors are run, the result of it is "Inconclusive: Test not run"
As far as I can tell this is tied to the plugin and not MSpec itself, I've tested it using the command line MSpec runner and the tests fail/succeed as expected.
Repro of the issue:
Nuget versions:
Machine.Specifications v0.12.0 (latest)
Machine.Specifications.Should v0.11.0 (latest)
From visual studio:
When using the MSpec command line runner (failing as expected):
Verbose logs from the runner:
The text was updated successfully, but these errors were encountered: