Skip to content

Commit

Permalink
Net core 3.1 support (#1823)
Browse files Browse the repository at this point in the history
* update the tests and tooling to run on .NET Core 3.1

* update TestProjectGenerator submodule
  • Loading branch information
nemesv committed Dec 18, 2019
1 parent b6c4d72 commit 054d3dd
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
<SpecFlow_Core_Generator_TFM>netstandard2.0</SpecFlow_Core_Generator_TFM>

<SpecFlow_FullFramework_Test_TFM>net471</SpecFlow_FullFramework_Test_TFM>
<SpecFlow_Core_Test_TFM>netcoreapp2.1;netcoreapp3.0</SpecFlow_Core_Test_TFM>
<SpecFlow_Core_Test_TFM>netcoreapp2.1;netcoreapp3.1</SpecFlow_Core_Test_TFM>

<SpecFlow_FullFramework_Specs_TFM>net471</SpecFlow_FullFramework_Specs_TFM>
<SpecFlow_Core_Specs_TFM>netcoreapp3.0</SpecFlow_Core_Specs_TFM>
<SpecFlow_Core_Specs_TFM>netcoreapp3.1</SpecFlow_Core_Specs_TFM>

<SpecFlow_FullFramework_Tools_TFM>net471</SpecFlow_FullFramework_Tools_TFM>
<SpecFlow_Core_Tools_TFM>netcoreapp2.0</SpecFlow_Core_Tools_TFM>
Expand Down
2 changes: 1 addition & 1 deletion ExternalRepositories/SpecFlow.TestProjectGenerator
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
"type": "parameter",
"description": "Target Framework",
"datatype": "choice",
"defaultValue": "netcoreapp3.0",
"defaultValue": "netcoreapp3.1",
"replaces": "$target$",
"choices": [
{
"choice": "netcoreapp3.0",
"choice": "netcoreapp3.1",
"description": ".NET Core 3"
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<Import Project="..\..\SpecFlow.Tools.MsBuild.Generation\build\SpecFlow.Tools.MsBuild.Generation.props" />

<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<TargetFramework>$(SpecFlow_Core_Specs_TFM)</TargetFramework>
<RunPostBuildEvent>Always</RunPostBuildEvent>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private IEnumerable<KeyValuePair<Combination, IFeatureGenerator>> GetFilteredFea
if (onlyDotNetCore)
{
if (ShouldCompileForNetCore21(featureGenerator.Key)
|| ShouldCompileForNetCore30(featureGenerator.Key))
|| ShouldCompileForNetCore31(featureGenerator.Key))
{
yield return featureGenerator;
}
Expand Down Expand Up @@ -158,7 +158,7 @@ private IEnumerable<KeyValuePair<Combination, IFeatureGenerator>> GetFilteredFea
if (onlyDotNetCore)
{
if (ShouldCompileForNetCore21(featureGenerator.Key)
|| ShouldCompileForNetCore30(featureGenerator.Key))
|| ShouldCompileForNetCore31(featureGenerator.Key))
{
yield return featureGenerator;
}
Expand All @@ -178,9 +178,9 @@ public bool ShouldCompileForNetCore21(Combination combination)
&& RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
}

public bool ShouldCompileForNetCore30(Combination combination)
public bool ShouldCompileForNetCore31(Combination combination)
{
return combination.TargetFramework == TestRunCombinations.TfmEnumValueNetCore30;
return combination.TargetFramework == TestRunCombinations.TfmEnumValueNetCore31;
}

private bool IsForUnitTestProvider(KeyValuePair<Combination, IFeatureGenerator> featureGenerator, string unitTestProvider)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@ public class TestRunCombinations
{
public const string TfmEnumValueNet452 = "Net452";
public const string TfmEnumValueNetCore21 = "Netcoreapp21";
public const string TfmEnumValueNetCore30 = "Netcoreapp30";
public const string TfmEnumValueNetCore31 = "Netcoreapp31";

public static List<Combination> List { get; } = new List<Combination>()
{
#if XUNIT_SPECS
new Combination() {ProgrammingLanguage = "CSharp", ProjectFormat = "Old", TargetFramework = TfmEnumValueNet452, UnitTestProvider = "xUnit", ConfigFormat = "Config"},
new Combination() {ProgrammingLanguage = "CSharp", ProjectFormat = "New", TargetFramework = TfmEnumValueNet452, UnitTestProvider = "xUnit", ConfigFormat = "Config"},
new Combination() {ProgrammingLanguage = "CSharp", ProjectFormat = "New", TargetFramework = TfmEnumValueNetCore21, UnitTestProvider = "xUnit", ConfigFormat = "Json"},
new Combination() {ProgrammingLanguage = "CSharp", ProjectFormat = "New", TargetFramework = TfmEnumValueNetCore30, UnitTestProvider = "xUnit", ConfigFormat = "Json"},
new Combination() {ProgrammingLanguage = "CSharp", ProjectFormat = "New", TargetFramework = TfmEnumValueNetCore31, UnitTestProvider = "xUnit", ConfigFormat = "Json"},
#endif

#if MSTEST_SPECS
new Combination() {ProgrammingLanguage = "CSharp", ProjectFormat = "New", TargetFramework = TfmEnumValueNet452, UnitTestProvider = "MSTest", ConfigFormat = "Config"},
new Combination() {ProgrammingLanguage = "CSharp", ProjectFormat = "New", TargetFramework = TfmEnumValueNetCore21, UnitTestProvider = "MSTest", ConfigFormat = "Json"},
new Combination() {ProgrammingLanguage = "CSharp", ProjectFormat = "New", TargetFramework = TfmEnumValueNetCore30, UnitTestProvider = "MSTest", ConfigFormat = "Json"},
new Combination() {ProgrammingLanguage = "CSharp", ProjectFormat = "New", TargetFramework = TfmEnumValueNetCore31, UnitTestProvider = "MSTest", ConfigFormat = "Json"},
#endif

#if NUNIT_SPECS
new Combination() {ProgrammingLanguage = "CSharp", ProjectFormat = "New", TargetFramework = TfmEnumValueNet452, UnitTestProvider = "NUnit3", ConfigFormat = "Config"},
new Combination() {ProgrammingLanguage = "CSharp", ProjectFormat = "New", TargetFramework = TfmEnumValueNetCore21, UnitTestProvider = "NUnit3", ConfigFormat = "Json"},
new Combination() {ProgrammingLanguage = "CSharp", ProjectFormat = "New", TargetFramework = TfmEnumValueNetCore30, UnitTestProvider = "NUnit3", ConfigFormat = "Json"},
new Combination() {ProgrammingLanguage = "CSharp", ProjectFormat = "New", TargetFramework = TfmEnumValueNetCore31, UnitTestProvider = "NUnit3", ConfigFormat = "Json"},
#endif
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void WhenTheParsedResultIsSavedTo(string parsedFileName)
{
var assemblyFolder = AssemblyFolderHelper.GetAssemblyFolder();

assemblyFolder.Should().EndWith(@"\bin\Debug\netcoreapp3.0", "parsed file saving can only be done from a development environment");
assemblyFolder.Should().EndWith(@"\bin\Debug\netcoreapp3.1", "parsed file saving can only be done from a development environment");
parserDriver.SaveSerializedFeatureTo(Path.Combine(assemblyFolder, @"..\..\..\TestFiles", parsedFileName));
}

Expand Down
2 changes: 1 addition & 1 deletion build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ parameters:
name: ''
pool: ''
nugetVersion: 5.1.0
sdkVersion: 3.0.100
sdkVersion: 3.1.100
artifactFileName: ''
appInsightsInstrumentationKey: ''

Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sdk": {
"version": "3.0.100"
"version": "3.1.100"
}
}

0 comments on commit 054d3dd

Please sign in to comment.