-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Discovery error for SpecFlow v3.7 (missing method exception) (Issue #69)
- Loading branch information
1 parent
a462481
commit d39e4f7
Showing
12 changed files
with
151 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...low37NetCoreConnector.Tests/Deveroom.VisualStudio.SpecFlow37NetCoreConnector.Tests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks> | ||
<IsPackable>false</IsPackable> | ||
<SignAssembly>true</SignAssembly> | ||
<AssemblyOriginatorKeyFile>..\..\Key.snk</AssemblyOriginatorKeyFile> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="FluentAssertions" Version="5.6.0" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" /> | ||
<PackageReference Include="SpecFlow.xUnit" Version="3.7.13" NoWarn="NU1608" /> | ||
<PackageReference Include="xunit" Version="2.4.1" /> | ||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\Deveroom.VisualStudio.SpecFlowConnector.Models\Deveroom.VisualStudio.SpecFlowConnector.Models.csproj" /> | ||
<ProjectReference Include="..\..\Deveroom.VisualStudio.SpecFlowConnector.V2\Deveroom.VisualStudio.SpecFlowConnector.V2.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
78 changes: 78 additions & 0 deletions
78
...veroom.VisualStudio.SpecFlow37NetCoreConnector.Tests/SpecFlowV37DiscovererNetCoreTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Runtime.Loader; | ||
using Deveroom.VisualStudio.SpecFlowConnector.Discovery.V31; | ||
using Deveroom.VisualStudio.SpecFlowConnector.Models; | ||
using FluentAssertions; | ||
using TechTalk.SpecFlow; | ||
using Xunit; | ||
|
||
namespace Deveroom.VisualStudio.SpecFlow37NetCoreConnector.Tests | ||
{ | ||
public class SpecFlowV37DiscovererNetCoreTests | ||
{ | ||
private SpecFlowV31Discoverer CreateSut() | ||
{ | ||
var stubDiscoverer = new SpecFlowV31Discoverer(AssemblyLoadContext.Default); | ||
return stubDiscoverer; | ||
} | ||
|
||
private string GetTestAssemblyPath() | ||
{ | ||
return Assembly.GetExecutingAssembly().Location; | ||
} | ||
|
||
private DiscoveryResult PerformDiscover(SpecFlowV31Discoverer sut) | ||
{ | ||
var testAssemblyPath = GetTestAssemblyPath(); | ||
var testAssembly = Assembly.LoadFrom(testAssemblyPath); | ||
return sut.DiscoverInternal(testAssembly, testAssemblyPath, null); | ||
} | ||
|
||
[Binding] | ||
public class SampleBindings | ||
{ | ||
[When(@"I press add")] | ||
public void WhenIPressAdd() { } | ||
|
||
public static bool BeforeTestRunHookCalled = false; | ||
[BeforeTestRun] | ||
public static void BeforeTestRunHook() | ||
{ | ||
BeforeTestRunHookCalled = true; | ||
} | ||
|
||
public static bool AfterTestRunHookCalled = false; | ||
[AfterTestRun] | ||
public static void AfterTestRunHook() | ||
{ | ||
AfterTestRunHookCalled = true; | ||
} | ||
} | ||
|
||
[Fact] | ||
public void Discovers_step_definitions() | ||
{ | ||
var sut = CreateSut(); | ||
|
||
var result = PerformDiscover(sut); | ||
|
||
result.StepDefinitions.Should().NotBeNullOrEmpty(); | ||
} | ||
|
||
[Fact] | ||
public void Should_not_invoke_BeforeAfterTestRun_hook_during_discovery_Issue_27() | ||
{ | ||
var sut = CreateSut(); | ||
SampleBindings.BeforeTestRunHookCalled = false; | ||
SampleBindings.AfterTestRunHookCalled = false; | ||
|
||
var result = PerformDiscover(sut); | ||
|
||
result.StepDefinitions.Should().NotBeNullOrEmpty(); | ||
SampleBindings.AfterTestRunHookCalled.Should().BeFalse(); | ||
SampleBindings.BeforeTestRunHookCalled.Should().BeFalse(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters