From 7f4507da827b1629241b956e7c0976c55f129e84 Mon Sep 17 00:00:00 2001 From: 0x4D616E75 <0x4d616e75@elektronische-nachricht.de> Date: Sun, 20 Jan 2019 09:59:37 +0100 Subject: [PATCH 01/21] Removing System.Runtime.Remoting dependencies, these aren't supported by .netstandard2.0 --- .../ReportingAspect/ReportingAttribute.cs | 38 ------------ .../ReportingAspect/ReportingMessageSink.cs | 59 ------------------- SpecNuts/ReportingAspect/ReportingProperty.cs | 33 ----------- SpecNuts/ReportingStepDefinitions.cs | 2 - 4 files changed, 132 deletions(-) delete mode 100644 SpecNuts/ReportingAspect/ReportingAttribute.cs delete mode 100644 SpecNuts/ReportingAspect/ReportingMessageSink.cs delete mode 100644 SpecNuts/ReportingAspect/ReportingProperty.cs diff --git a/SpecNuts/ReportingAspect/ReportingAttribute.cs b/SpecNuts/ReportingAspect/ReportingAttribute.cs deleted file mode 100644 index f2f0abb..0000000 --- a/SpecNuts/ReportingAspect/ReportingAttribute.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.Runtime.Remoting.Activation; -using System.Runtime.Remoting.Contexts; - -namespace SpecNuts.ReportingAspect -{ - internal class ReportingAttribute : ContextAttribute - { - public ReportingAttribute() - : base("Reporting") - { - } - - public override void GetPropertiesForNewContext(IConstructionCallMessage ccm) - { - ccm.ContextProperties.Add(new ReportingProperty()); - } - - public override bool IsContextOK(Context ctx, IConstructionCallMessage ctorMsg) - { - var p = ctx.GetProperty("Reporting") as ReportingProperty; - if (p == null) - { - return false; - } - return true; - } - - public override bool IsNewContextOK(Context newCtx) - { - var p = newCtx.GetProperty("Reporting") as ReportingProperty; - if (p == null) - { - return false; - } - return true; - } - } -} \ No newline at end of file diff --git a/SpecNuts/ReportingAspect/ReportingMessageSink.cs b/SpecNuts/ReportingAspect/ReportingMessageSink.cs deleted file mode 100644 index 70584a1..0000000 --- a/SpecNuts/ReportingAspect/ReportingMessageSink.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System.Runtime.Remoting.Messaging; -using System.Threading.Tasks; - -namespace SpecNuts.ReportingAspect -{ - internal class ReportingMessageSink : IMessageSink - { - public ReportingMessageSink(IMessageSink next) - { - NextSink = next; - } - - public IMessageSink NextSink { get; private set; } - - public IMessageCtrl AsyncProcessMessage(IMessage msg, IMessageSink replySink) - { - var rtnMsgCtrl = NextSink.AsyncProcessMessage(msg, replySink); - return rtnMsgCtrl; - } - - public IMessage SyncProcessMessage(IMessage msg) - { - var methodMessage = new MethodCallMessageWrapper((IMethodCallMessage)msg); - - // Avoid reporting proxy method calls for fields injected via the constructor - // in the step definition classes. This caused some steps to pe reported twice. - if (methodMessage.MethodName == "FieldGetter") - { - return NextSink.SyncProcessMessage(msg); - } - - IMethodReturnMessage mrm = null; - var task = Reporters.ExecuteStep( - () => - { - mrm = (IMethodReturnMessage)NextSink.SyncProcessMessage(msg); - - if (mrm.Exception != null) - { - return Task.FromException(mrm.Exception); - } - - return (mrm.ReturnValue as Task) ?? Task.CompletedTask; - }, - methodMessage.MethodBase, - methodMessage.Args - ); - - if (task.IsCompleted) - { - return mrm; - } - else - { - return new ReturnMessage(task, null, 0, mrm.LogicalCallContext, methodMessage); - } - } - } -} \ No newline at end of file diff --git a/SpecNuts/ReportingAspect/ReportingProperty.cs b/SpecNuts/ReportingAspect/ReportingProperty.cs deleted file mode 100644 index f9ace7d..0000000 --- a/SpecNuts/ReportingAspect/ReportingProperty.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Runtime.Remoting.Contexts; -using System.Runtime.Remoting.Messaging; - -namespace SpecNuts.ReportingAspect -{ - internal class ReportingProperty : IContextProperty, IContributeObjectSink - { - public void Freeze(Context newContext) - { - } - - public bool IsNewContextOK(Context newCtx) - { - var p = newCtx.GetProperty("Reporting") as ReportingProperty; - if (p == null) - { - return false; - } - return true; - } - - public string Name - { - get { return "Reporting"; } - } - - public IMessageSink GetObjectSink(MarshalByRefObject o, IMessageSink next) - { - return new ReportingMessageSink(next); - } - } -} \ No newline at end of file diff --git a/SpecNuts/ReportingStepDefinitions.cs b/SpecNuts/ReportingStepDefinitions.cs index ea36d4b..9c823d2 100644 --- a/SpecNuts/ReportingStepDefinitions.cs +++ b/SpecNuts/ReportingStepDefinitions.cs @@ -1,10 +1,8 @@ using System; using System.Threading.Tasks; -using SpecNuts.ReportingAspect; namespace SpecNuts { - [Reporting] public abstract class ReportingStepDefinitions : ContextBoundObject { public async Task ReportStep(Func stepFunc, params object[] args) From b4e30fc7f22fe0b0fa0ae11adffa22cef5c63de3 Mon Sep 17 00:00:00 2001 From: 0x4D616E75 <0x4d616e75@elektronische-nachricht.de> Date: Sun, 20 Jan 2019 10:00:30 +0100 Subject: [PATCH 02/21] fix property override warning --- SpecNuts/Model/Feature.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SpecNuts/Model/Feature.cs b/SpecNuts/Model/Feature.cs index 1c567ec..59687c5 100644 --- a/SpecNuts/Model/Feature.cs +++ b/SpecNuts/Model/Feature.cs @@ -8,7 +8,7 @@ public class Feature : TaggedReportItem private static readonly string DefaultUri = "/uri/placeholder"; - public string Description + public new string Description { get { return _description; } set { _description = string.IsNullOrEmpty(value) ? value : value.Replace("\r", ""); } From 0c8092c6cee80bb9f9642ce6f52a05f2ef2a2ebe Mon Sep 17 00:00:00 2001 From: 0x4D616E75 <0x4d616e75@elektronische-nachricht.de> Date: Sun, 20 Jan 2019 10:06:09 +0100 Subject: [PATCH 03/21] upgrade csproj to new format and update dependencies --- SpecNuts/SpecNuts.csproj | 74 +++++++--------------------------------- 1 file changed, 12 insertions(+), 62 deletions(-) diff --git a/SpecNuts/SpecNuts.csproj b/SpecNuts/SpecNuts.csproj index fbae2d5..643478b 100644 --- a/SpecNuts/SpecNuts.csproj +++ b/SpecNuts/SpecNuts.csproj @@ -1,20 +1,17 @@ - - - + Debug AnyCPU - {EABA391E-6B65-4E5C-8842-3D71A5F97B4F} Library Properties SpecNuts SpecNuts - v4.6 + netstandard2.0 512 - ..\ true + true full @@ -24,6 +21,7 @@ prompt 4 false + false pdbonly @@ -33,6 +31,7 @@ prompt 4 false + false bin\Build Nuget Packages\ @@ -44,6 +43,7 @@ MinimumRecommendedRules.ruleset bin\Build Nuget Packages\SpecNuts.xml false + false bin\NuGet\ @@ -54,56 +54,16 @@ prompt MinimumRecommendedRules.ruleset false + false - - ..\packages\MarkdownSharp.1.13.0.0\lib\35\MarkdownSharp.dll - - - - - - - - - - ..\packages\Newtonsoft.Json.11.0.1\lib\net45\Newtonsoft.Json.dll - - - ..\packages\System.ValueTuple.4.3.0\lib\netstandard1.0\System.ValueTuple.dll - - - ..\packages\SpecFlow.2.3.1\lib\net45\TechTalk.SpecFlow.dll - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -111,14 +71,4 @@ - - - - \ No newline at end of file From 71eb215da300ed69b0cf0e407b95638343d637d9 Mon Sep 17 00:00:00 2001 From: 0x4D616E75 <0x4d616e75@elektronische-nachricht.de> Date: Sun, 20 Jan 2019 10:08:09 +0100 Subject: [PATCH 04/21] Moving assembly informations from AssemblyInfo.cs to Specuts.csproj --- SpecNuts/Properties/AssemblyInfo.cs | 10 +--------- SpecNuts/SpecNuts.csproj | 12 ++++++++++++ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/SpecNuts/Properties/AssemblyInfo.cs b/SpecNuts/Properties/AssemblyInfo.cs index ed3f4bf..9b04460 100644 --- a/SpecNuts/Properties/AssemblyInfo.cs +++ b/SpecNuts/Properties/AssemblyInfo.cs @@ -1,15 +1,7 @@ using System.Reflection; using System.Runtime.InteropServices; -[assembly: AssemblyTitle("SpecNuts")] -[assembly: AssemblyDescription("A forked from SpecResults project to provide the ability to generate test result in cucumber format.")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("William Sia")] -[assembly: AssemblyProduct("SpecNuts")] -[assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] -[assembly: Guid("301e04c6-bc1b-4da4-83f0-5fdf76fea8bb")] -[assembly: AssemblyVersion("1.1.0.0")] -[assembly: AssemblyFileVersion("1.1.0.0")] \ No newline at end of file +[assembly: Guid("301e04c6-bc1b-4da4-83f0-5fdf76fea8bb")] \ No newline at end of file diff --git a/SpecNuts/SpecNuts.csproj b/SpecNuts/SpecNuts.csproj index 643478b..d3f053d 100644 --- a/SpecNuts/SpecNuts.csproj +++ b/SpecNuts/SpecNuts.csproj @@ -1,4 +1,16 @@  + + SpecNuts + + A forked from SpecResults project to provide the ability to generate test result in cucumber format. + William Sia + SpecNuts + Copyright © 2016 + 1.1.0.0 + 1.1.0 + 1.1.0.0 + + Debug AnyCPU From b67d0a04f0f32c308bca44bc6b3371d9aa57308f Mon Sep 17 00:00:00 2001 From: 0x4D616E75 <0x4d616e75@elektronische-nachricht.de> Date: Sun, 20 Jan 2019 13:18:48 +0100 Subject: [PATCH 05/21] Removing packages.config --- SpecNuts/packages.config | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 SpecNuts/packages.config diff --git a/SpecNuts/packages.config b/SpecNuts/packages.config deleted file mode 100644 index 5c7712a..0000000 --- a/SpecNuts/packages.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file From f9b5d00afe9ff4dd69a30b558194f0739111c1aa Mon Sep 17 00:00:00 2001 From: 0x4D616E75 <0x4d616e75@elektronische-nachricht.de> Date: Sun, 20 Jan 2019 13:22:37 +0100 Subject: [PATCH 06/21] moving to new csproj format, switch to netcoreapp2.1 framework and remove packages.config for UnitTest --- SpecNuts.UnitTests/SpecNuts.UnitTests.csproj | 47 +++++--------------- SpecNuts.UnitTests/packages.config | 4 -- 2 files changed, 10 insertions(+), 41 deletions(-) delete mode 100644 SpecNuts.UnitTests/packages.config diff --git a/SpecNuts.UnitTests/SpecNuts.UnitTests.csproj b/SpecNuts.UnitTests/SpecNuts.UnitTests.csproj index 2d00a0f..71c5bae 100644 --- a/SpecNuts.UnitTests/SpecNuts.UnitTests.csproj +++ b/SpecNuts.UnitTests/SpecNuts.UnitTests.csproj @@ -1,20 +1,17 @@ - - - Debug AnyCPU - {95C18142-2C66-4CA9-8F63-A9B7F65A1820} Library Properties SpecResults.UnitTests SpecResults.UnitTests - v4.6 + netcoreapp2.1 512 ..\ true - + false + true full @@ -32,41 +29,17 @@ prompt 4 + - - ..\packages\NUnit.2.6.3\lib\nunit.framework.dll - - - - - - - - + + + + - - + - - {eaba391e-6b65-4e5c-8842-3d71a5f97b4f} - SpecNuts - + - - - - - - - - - \ No newline at end of file diff --git a/SpecNuts.UnitTests/packages.config b/SpecNuts.UnitTests/packages.config deleted file mode 100644 index ad37a52..0000000 --- a/SpecNuts.UnitTests/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file From eb762ff47f10c002e2a1e0aae4cbe7c84559866c Mon Sep 17 00:00:00 2001 From: 0x4D616E75 <0x4d616e75@elektronische-nachricht.de> Date: Sun, 20 Jan 2019 13:23:17 +0100 Subject: [PATCH 07/21] Move assembly informations of unit tests to csproj file --- SpecNuts.UnitTests/Properties/AssemblyInfo.cs | 22 +------------------ SpecNuts.UnitTests/SpecNuts.UnitTests.csproj | 14 ++++++++++++ 2 files changed, 15 insertions(+), 21 deletions(-) diff --git a/SpecNuts.UnitTests/Properties/AssemblyInfo.cs b/SpecNuts.UnitTests/Properties/AssemblyInfo.cs index 7a2dbfc..11952a5 100644 --- a/SpecNuts.UnitTests/Properties/AssemblyInfo.cs +++ b/SpecNuts.UnitTests/Properties/AssemblyInfo.cs @@ -5,12 +5,6 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("SpecResults.UnitTests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("SpecResults.UnitTests")] -[assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -22,18 +16,4 @@ // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("fdba9fc2-64df-467a-a836-654e5bc76d96")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] - -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file +[assembly: Guid("fdba9fc2-64df-467a-a836-654e5bc76d96")] \ No newline at end of file diff --git a/SpecNuts.UnitTests/SpecNuts.UnitTests.csproj b/SpecNuts.UnitTests/SpecNuts.UnitTests.csproj index 71c5bae..b98e83a 100644 --- a/SpecNuts.UnitTests/SpecNuts.UnitTests.csproj +++ b/SpecNuts.UnitTests/SpecNuts.UnitTests.csproj @@ -1,3 +1,17 @@ + + + SpecResults.UnitTests + + + + SpecResults.UnitTests + Copyright © 2014 + 1.0.0.0 + 1.0.0 + 1.0.0.0 + + + Debug AnyCPU From 2ec4c7eb606cde67424e94f796e51e1d4f56bfb5 Mon Sep 17 00:00:00 2001 From: 0x4D616E75 <0x4d616e75@elektronische-nachricht.de> Date: Sun, 20 Jan 2019 13:35:19 +0100 Subject: [PATCH 08/21] Switching SpecNuts.Json to new .netstandard2.0 --- SpecNuts.Json/Properties/AssemblyInfo.cs | 22 +------- SpecNuts.Json/SpecNuts.Json.csproj | 67 ++++++------------------ SpecNuts.Json/packages.config | 6 --- 3 files changed, 17 insertions(+), 78 deletions(-) delete mode 100644 SpecNuts.Json/packages.config diff --git a/SpecNuts.Json/Properties/AssemblyInfo.cs b/SpecNuts.Json/Properties/AssemblyInfo.cs index 70a9272..788947d 100644 --- a/SpecNuts.Json/Properties/AssemblyInfo.cs +++ b/SpecNuts.Json/Properties/AssemblyInfo.cs @@ -5,12 +5,6 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("SpecNuts.Json")] -[assembly: AssemblyDescription("A forked from SpecResults.Json project to provide the ability to generate json file in cucumber format.")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("William Sia")] -[assembly: AssemblyProduct("SpecNuts.Json")] -[assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -22,18 +16,4 @@ // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("4ebe0eb3-a53b-4bda-91aa-187a31592ff7")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] - -[assembly: AssemblyVersion("1.1.0.0")] -[assembly: AssemblyFileVersion("1.1.0.0")] \ No newline at end of file +[assembly: Guid("4ebe0eb3-a53b-4bda-91aa-187a31592ff7")] \ No newline at end of file diff --git a/SpecNuts.Json/SpecNuts.Json.csproj b/SpecNuts.Json/SpecNuts.Json.csproj index 0207946..8cc94aa 100644 --- a/SpecNuts.Json/SpecNuts.Json.csproj +++ b/SpecNuts.Json/SpecNuts.Json.csproj @@ -1,17 +1,25 @@ - - - + + + SpecNuts.Json + + A forked from SpecResults.Json project to provide the ability to generate json file in cucumber format. + William Sia + SpecNuts.Json + Copyright © 2016 + 1.1.0.0 + 1.1.0 + 1.1.0.0 + + Debug AnyCPU - {C830C923-5398-4F28-99C2-1592EE5F4F7B} Library Properties SpecNuts.Json SpecNuts.Json - v4.6 + netstandard2.0 512 - ..\..\ true @@ -56,52 +64,9 @@ false - - - - - - - - - ..\packages\Newtonsoft.Json.11.0.1\lib\net45\Newtonsoft.Json.dll - - - ..\packages\System.ValueTuple.4.3.0\lib\netstandard1.0\System.ValueTuple.dll - - - ..\packages\SpecFlow.2.3.1\lib\net45\TechTalk.SpecFlow.dll - - - - - - - + - - - + - - - {eaba391e-6b65-4e5c-8842-3d71a5f97b4f} - SpecNuts - - - - - - - - - - \ No newline at end of file diff --git a/SpecNuts.Json/packages.config b/SpecNuts.Json/packages.config deleted file mode 100644 index c6a5434..0000000 --- a/SpecNuts.Json/packages.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file From e9b0d8ed47a3f22d4d291509b357662afa577078 Mon Sep 17 00:00:00 2001 From: 0x4D616E75 <0x4d616e75@elektronische-nachricht.de> Date: Wed, 23 Jan 2019 14:42:12 +0100 Subject: [PATCH 09/21] move SpecNuts.ApprovalTestSuite to new csproj format and set target framework to .netcoreapp2.1 --- .../Properties/AssemblyInfo.cs | 24 +--- .../SpecNuts.ApprovalTestSuite.csproj | 109 +++++++----------- .../TestSuite.feature.cs | 79 ++++++++----- SpecNuts.ApprovalTestSuite/packages.config | 9 -- 4 files changed, 89 insertions(+), 132 deletions(-) delete mode 100644 SpecNuts.ApprovalTestSuite/packages.config diff --git a/SpecNuts.ApprovalTestSuite/Properties/AssemblyInfo.cs b/SpecNuts.ApprovalTestSuite/Properties/AssemblyInfo.cs index 4444e0a..19f995b 100644 --- a/SpecNuts.ApprovalTestSuite/Properties/AssemblyInfo.cs +++ b/SpecNuts.ApprovalTestSuite/Properties/AssemblyInfo.cs @@ -5,14 +5,6 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("SpecNuts.ApprovalTestSuite")] -[assembly: - AssemblyDescription( - "A forked from SpecResults.ApprovalTestSuite project to provide the ability to generate json file in cucumber format.")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("William Sia")] -[assembly: AssemblyProduct("SpecNuts.ApprovalTestSuite")] -[assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -24,18 +16,4 @@ // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("a5289c34-47cc-4acf-80ef-d286a5779959")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] - -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file +[assembly: Guid("a5289c34-47cc-4acf-80ef-d286a5779959")] \ No newline at end of file diff --git a/SpecNuts.ApprovalTestSuite/SpecNuts.ApprovalTestSuite.csproj b/SpecNuts.ApprovalTestSuite/SpecNuts.ApprovalTestSuite.csproj index 8b4cd29..1ee1a33 100644 --- a/SpecNuts.ApprovalTestSuite/SpecNuts.ApprovalTestSuite.csproj +++ b/SpecNuts.ApprovalTestSuite/SpecNuts.ApprovalTestSuite.csproj @@ -1,21 +1,34 @@ - - - + + - Debug + SpecNuts.ApprovalTestSuite" + + A forked from SpecResults.ApprovalTestSuite project to provide the ability to generate json file in cucumber format. + William Sia + SpecNuts.ApprovalTestSuite" + Copyright © 2016 + 1.0.0.0 + 1.0.0 + 1.0.0.0 + + + + Debug AnyCPU {BBA703FA-94C4-437F-9961-2A321163988A} Library Properties SpecResults.ApprovalTestSuite SpecResults.ApprovalTestSuite - v4.6 + netcoreapp2.1 512 ..\ true + false - + + true full false @@ -56,79 +69,39 @@ MinimumRecommendedRules.ruleset false + - - ..\packages\ApprovalTests.3.0.5\lib\net40\ApprovalTests.dll - - - ..\packages\ApprovalUtilities.3.0.5\lib\net35\ApprovalUtilities.dll - - - - ..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll - - - ..\packages\NUnit.2.6.3\lib\nunit.framework.dll - - - - - - - - - ..\packages\System.ValueTuple.4.3.0\lib\netstandard1.0\System.ValueTuple.dll - - - ..\packages\SpecFlow.2.3.1\lib\net45\TechTalk.SpecFlow.dll - + + + + + + + + - - True - True - TestSuite.feature - - - - + + + + - - - - - SpecFlowSingleFileGenerator - TestSuite.feature.cs - - - {c830c923-5398-4f28-99c2-1592ee5f4f7b} - SpecNuts.Json - - - {eaba391e-6b65-4e5c-8842-3d71a5f97b4f} - SpecNuts - + + - + - + + + TestSuite.feature + + + - - - - - - \ No newline at end of file diff --git a/SpecNuts.ApprovalTestSuite/TestSuite.feature.cs b/SpecNuts.ApprovalTestSuite/TestSuite.feature.cs index d9876ff..d6a6ffa 100644 --- a/SpecNuts.ApprovalTestSuite/TestSuite.feature.cs +++ b/SpecNuts.ApprovalTestSuite/TestSuite.feature.cs @@ -1,8 +1,8 @@ -// ------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ // // This code was generated by SpecFlow (http://www.specflow.org/). -// SpecFlow Version:2.1.0.0 -// SpecFlow Generator Version:2.0.0.0 +// SpecFlow Version:3.0.0.0 +// SpecFlow Generator Version:3.0.0.0 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -15,7 +15,7 @@ namespace SpecResults.ApprovalTestSuite using TechTalk.SpecFlow; - [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "2.1.0.0")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "3.0.0.0")] [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [NUnit.Framework.TestFixtureAttribute()] [NUnit.Framework.DescriptionAttribute("Test Suite")] @@ -28,17 +28,17 @@ public partial class TestSuiteFeature #line 1 "TestSuite.feature" #line hidden - [NUnit.Framework.TestFixtureSetUpAttribute()] + [NUnit.Framework.OneTimeSetUpAttribute()] public virtual void FeatureSetup() { testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(); - TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Test Suite", "\tIn order to test my reporter plugin\r\n\tAs a developer\r\n\tI want to run a predefine" + - "d test suite", ProgrammingLanguage.CSharp, new string[] { + TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Test Suite", "\tIn order to test my reporter plugin\n\tAs a developer\n\tI want to run a predefined " + + "test suite", ProgrammingLanguage.CSharp, new string[] { "Category:SomeFeatureCategory"}); testRunner.OnFeatureStart(featureInfo); } - [NUnit.Framework.TestFixtureTearDownAttribute()] + [NUnit.Framework.OneTimeTearDownAttribute()] public virtual void FeatureTearDown() { testRunner.OnFeatureEnd(); @@ -56,9 +56,15 @@ public virtual void ScenarioTearDown() testRunner.OnScenarioEnd(); } - public virtual void ScenarioSetup(TechTalk.SpecFlow.ScenarioInfo scenarioInfo) + public virtual void ScenarioInitialize(TechTalk.SpecFlow.ScenarioInfo scenarioInfo) + { + testRunner.OnScenarioInitialize(scenarioInfo); + testRunner.ScenarioContext.ScenarioContainer.RegisterInstanceAs(NUnit.Framework.TestContext.CurrentContext); + } + + public virtual void ScenarioStart() { - testRunner.OnScenarioStart(scenarioInfo); + testRunner.OnScenarioStart(); } public virtual void ScenarioCleanup() @@ -71,10 +77,11 @@ public virtual void ScenarioCleanup() [NUnit.Framework.CategoryAttribute("SomeTag")] public virtual void SingleScenario() { - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Single scenario", new string[] { + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Single scenario", null, new string[] { "SomeTag"}); #line 8 -this.ScenarioSetup(scenarioInfo); +this.ScenarioInitialize(scenarioInfo); + this.ScenarioStart(); #line 9 testRunner.Given("a scenario is specified", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); #line 10 @@ -89,9 +96,10 @@ public virtual void SingleScenario() [NUnit.Framework.DescriptionAttribute("Steps contain arguments")] public virtual void StepsContainArguments() { - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Steps contain arguments", ((string[])(null))); + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Steps contain arguments", null, ((string[])(null))); #line 13 -this.ScenarioSetup(scenarioInfo); +this.ScenarioInitialize(scenarioInfo); + this.ScenarioStart(); #line 14 testRunner.Given("a \"awesome\" scenario is specified", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); #line 15 @@ -106,15 +114,16 @@ public virtual void StepsContainArguments() [NUnit.Framework.DescriptionAttribute("Steps contain multi arguments")] public virtual void StepsContainMultiArguments() { - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Steps contain multi arguments", ((string[])(null))); + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Steps contain multi arguments", null, ((string[])(null))); #line 18 -this.ScenarioSetup(scenarioInfo); +this.ScenarioInitialize(scenarioInfo); + this.ScenarioStart(); #line hidden #line 19 - testRunner.Given("a \"awesome\" scenario is specified with a multi-line argument", "Here we go with mulitiple\r\nlines!", ((TechTalk.SpecFlow.Table)(null)), "Given "); + testRunner.Given("a \"awesome\" scenario is specified with a multi-line argument", "Here we go with mulitiple\nlines!", ((TechTalk.SpecFlow.Table)(null)), "Given "); #line hidden #line 24 - testRunner.When("the tests with multiple line parameters", "like\r\nthis \r\none", ((TechTalk.SpecFlow.Table)(null)), "When "); + testRunner.When("the tests with multiple line parameters", "like\nthis \none", ((TechTalk.SpecFlow.Table)(null)), "When "); #line 30 testRunner.Then("\"1\" report is generated", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line hidden @@ -125,9 +134,10 @@ public virtual void StepsContainMultiArguments() [NUnit.Framework.DescriptionAttribute("Step is not implemented")] public virtual void StepIsNotImplemented() { - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Step is not implemented", ((string[])(null))); + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Step is not implemented", null, ((string[])(null))); #line 32 -this.ScenarioSetup(scenarioInfo); +this.ScenarioInitialize(scenarioInfo); + this.ScenarioStart(); #line 33 testRunner.Given("a scenario is specified", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); #line 34 @@ -142,9 +152,10 @@ public virtual void StepIsNotImplemented() [NUnit.Framework.DescriptionAttribute("Table param")] public virtual void TableParam() { - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Table param", ((string[])(null))); + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Table param", null, ((string[])(null))); #line 37 -this.ScenarioSetup(scenarioInfo); +this.ScenarioInitialize(scenarioInfo); + this.ScenarioStart(); #line 38 testRunner.Given("a scenario is specified", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); #line hidden @@ -172,9 +183,10 @@ public virtual void TableParam() [NUnit.Framework.DescriptionAttribute("Step uses method-name undescores style")] public virtual void StepUsesMethod_NameUndescoresStyle() { - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Step uses method-name undescores style", ((string[])(null))); + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Step uses method-name undescores style", null, ((string[])(null))); #line 46 -this.ScenarioSetup(scenarioInfo); +this.ScenarioInitialize(scenarioInfo); + this.ScenarioStart(); #line 47 testRunner.Given("a scenario is specified", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); #line 48 @@ -191,9 +203,10 @@ public virtual void StepUsesMethod_NameUndescoresStyle() [NUnit.Framework.DescriptionAttribute("Step uses method-name undescores style with table param")] public virtual void StepUsesMethod_NameUndescoresStyleWithTableParam() { - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Step uses method-name undescores style with table param", ((string[])(null))); + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Step uses method-name undescores style with table param", null, ((string[])(null))); #line 52 -this.ScenarioSetup(scenarioInfo); +this.ScenarioInitialize(scenarioInfo); + this.ScenarioStart(); #line 53 testRunner.Given("a scenario is specified", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); #line hidden @@ -221,9 +234,10 @@ public virtual void StepUsesMethod_NameUndescoresStyleWithTableParam() [NUnit.Framework.DescriptionAttribute("Nested step")] public virtual void NestedStep() { - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Nested step", ((string[])(null))); + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Nested step", null, ((string[])(null))); #line 61 -this.ScenarioSetup(scenarioInfo); +this.ScenarioInitialize(scenarioInfo); + this.ScenarioStart(); #line 62 testRunner.Given("a scenario is specified", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); #line 63 @@ -236,13 +250,14 @@ public virtual void NestedStep() [NUnit.Framework.TestAttribute()] [NUnit.Framework.DescriptionAttribute("eating")] - [NUnit.Framework.TestCaseAttribute("12", "5", "7", new string[0])] - [NUnit.Framework.TestCaseAttribute("20", "5", "15", new string[0])] + [NUnit.Framework.TestCaseAttribute("12", "5", "7", null)] + [NUnit.Framework.TestCaseAttribute("20", "5", "15", null)] public virtual void Eating(string start, string eat, string left, string[] exampleTags) { - TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("eating", exampleTags); + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("eating", null, exampleTags); #line 66 -this.ScenarioSetup(scenarioInfo); +this.ScenarioInitialize(scenarioInfo); + this.ScenarioStart(); #line 67 testRunner.Given(string.Format("there are {0} cucumbers", start), ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given "); #line 68 diff --git a/SpecNuts.ApprovalTestSuite/packages.config b/SpecNuts.ApprovalTestSuite/packages.config deleted file mode 100644 index ea40ead..0000000 --- a/SpecNuts.ApprovalTestSuite/packages.config +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file From 7f29dcdce6ce5564e436774f163f73b77da5529d Mon Sep 17 00:00:00 2001 From: 0x4D616E75 <0x4d616e75@elektronische-nachricht.de> Date: Wed, 23 Jan 2019 14:42:55 +0100 Subject: [PATCH 10/21] remove unused packages.config and add missing nuget.target to project files --- SpecNuts.Json/SpecNuts.Json.csproj | 2 ++ SpecNuts.UnitTests/SpecNuts.UnitTests.csproj | 2 ++ SpecNuts/SpecNuts.csproj | 8 +++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/SpecNuts.Json/SpecNuts.Json.csproj b/SpecNuts.Json/SpecNuts.Json.csproj index 8cc94aa..77626b4 100644 --- a/SpecNuts.Json/SpecNuts.Json.csproj +++ b/SpecNuts.Json/SpecNuts.Json.csproj @@ -69,4 +69,6 @@ + + \ No newline at end of file diff --git a/SpecNuts.UnitTests/SpecNuts.UnitTests.csproj b/SpecNuts.UnitTests/SpecNuts.UnitTests.csproj index b98e83a..474ad55 100644 --- a/SpecNuts.UnitTests/SpecNuts.UnitTests.csproj +++ b/SpecNuts.UnitTests/SpecNuts.UnitTests.csproj @@ -56,4 +56,6 @@ + + \ No newline at end of file diff --git a/SpecNuts/SpecNuts.csproj b/SpecNuts/SpecNuts.csproj index d3f053d..c002a39 100644 --- a/SpecNuts/SpecNuts.csproj +++ b/SpecNuts/SpecNuts.csproj @@ -77,10 +77,16 @@ + + + + + - + + \ No newline at end of file From e6b692296066bc7abc8e15eb3a4626a497958572 Mon Sep 17 00:00:00 2001 From: 0x4D616E75 <0x4d616e75@elektronische-nachricht.de> Date: Wed, 23 Jan 2019 14:51:02 +0100 Subject: [PATCH 11/21] Fix CS1998 warning --- SpecNuts.ApprovalTestSuite/Steps.Definitions.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SpecNuts.ApprovalTestSuite/Steps.Definitions.cs b/SpecNuts.ApprovalTestSuite/Steps.Definitions.cs index ee2c1b1..5c2454d 100644 --- a/SpecNuts.ApprovalTestSuite/Steps.Definitions.cs +++ b/SpecNuts.ApprovalTestSuite/Steps.Definitions.cs @@ -25,6 +25,8 @@ public void GivenAScenarioIsSpecified() [When(@"the tests run")] public async Task WhenTheTestsRun() { + // Prevents CS1998 + await Task.Run(() => { }); } [Then(@"a report is generated")] From 4c35410d2598561881c08b105b0efd2880d64189 Mon Sep 17 00:00:00 2001 From: 0x4D616E75 <0x4d616e75@elektronische-nachricht.de> Date: Wed, 23 Jan 2019 22:09:46 +0100 Subject: [PATCH 12/21] Removing deprecated app.config and switch to new specflow.json --- SpecNuts.ApprovalTestSuite/App.config | 28 ------------------- .../App.config.transform | 8 ------ .../SpecNuts.ApprovalTestSuite.csproj | 6 +++- SpecNuts.ApprovalTestSuite/specflow.json | 6 ++++ SpecNuts.Json/App.config | 17 ----------- SpecNuts/App.config | 14 ---------- SpecNuts/App.config.transform | 8 ------ SpecNuts/SpecNuts.csproj | 4 --- 8 files changed, 11 insertions(+), 80 deletions(-) delete mode 100644 SpecNuts.ApprovalTestSuite/App.config delete mode 100644 SpecNuts.ApprovalTestSuite/App.config.transform create mode 100644 SpecNuts.ApprovalTestSuite/specflow.json delete mode 100644 SpecNuts.Json/App.config delete mode 100644 SpecNuts/App.config delete mode 100644 SpecNuts/App.config.transform diff --git a/SpecNuts.ApprovalTestSuite/App.config b/SpecNuts.ApprovalTestSuite/App.config deleted file mode 100644 index ed1a566..0000000 --- a/SpecNuts.ApprovalTestSuite/App.config +++ /dev/null @@ -1,28 +0,0 @@ - - - -
- - - - - - - - - - - - - - - - - - - - - - - - diff --git a/SpecNuts.ApprovalTestSuite/App.config.transform b/SpecNuts.ApprovalTestSuite/App.config.transform deleted file mode 100644 index fa8fb99..0000000 --- a/SpecNuts.ApprovalTestSuite/App.config.transform +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/SpecNuts.ApprovalTestSuite/SpecNuts.ApprovalTestSuite.csproj b/SpecNuts.ApprovalTestSuite/SpecNuts.ApprovalTestSuite.csproj index 1ee1a33..6491e08 100644 --- a/SpecNuts.ApprovalTestSuite/SpecNuts.ApprovalTestSuite.csproj +++ b/SpecNuts.ApprovalTestSuite/SpecNuts.ApprovalTestSuite.csproj @@ -86,7 +86,6 @@ - @@ -103,5 +102,10 @@ + + + PreserveNewest + + \ No newline at end of file diff --git a/SpecNuts.ApprovalTestSuite/specflow.json b/SpecNuts.ApprovalTestSuite/specflow.json new file mode 100644 index 0000000..ff05030 --- /dev/null +++ b/SpecNuts.ApprovalTestSuite/specflow.json @@ -0,0 +1,6 @@ +{ + "stepAssemblies": + [ + { "assembly": "SpecNuts" } + ] +} \ No newline at end of file diff --git a/SpecNuts.Json/App.config b/SpecNuts.Json/App.config deleted file mode 100644 index 333c1fa..0000000 --- a/SpecNuts.Json/App.config +++ /dev/null @@ -1,17 +0,0 @@ - - - -
- - - - - - - - - - - - - diff --git a/SpecNuts/App.config b/SpecNuts/App.config deleted file mode 100644 index c97e16b..0000000 --- a/SpecNuts/App.config +++ /dev/null @@ -1,14 +0,0 @@ - - - -
- - - - - - - - - - diff --git a/SpecNuts/App.config.transform b/SpecNuts/App.config.transform deleted file mode 100644 index e3abde9..0000000 --- a/SpecNuts/App.config.transform +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/SpecNuts/SpecNuts.csproj b/SpecNuts/SpecNuts.csproj index c002a39..566471f 100644 --- a/SpecNuts/SpecNuts.csproj +++ b/SpecNuts/SpecNuts.csproj @@ -78,13 +78,9 @@ - - - - From 70f8e5bc15783d956cb7dece9e79caab5ef9d054 Mon Sep 17 00:00:00 2001 From: 0x4D616E75 <0x4d616e75@elektronische-nachricht.de> Date: Wed, 23 Jan 2019 22:11:55 +0100 Subject: [PATCH 13/21] Switch from depreated use of ScenarioContext.Current and FeatureContext.Current to DI --- .../Steps.Definitions.cs | 12 +++++++++--- SpecNuts/Extensions.cs | 2 +- SpecNuts/Reporters.SpecFlowHooks.cs | 18 +++++++++--------- SpecNuts/Reporters.cs | 12 ++++++------ SpecNuts/ReportingStepDefinitions.cs | 5 +++-- 5 files changed, 28 insertions(+), 21 deletions(-) diff --git a/SpecNuts.ApprovalTestSuite/Steps.Definitions.cs b/SpecNuts.ApprovalTestSuite/Steps.Definitions.cs index 5c2454d..ec61170 100644 --- a/SpecNuts.ApprovalTestSuite/Steps.Definitions.cs +++ b/SpecNuts.ApprovalTestSuite/Steps.Definitions.cs @@ -9,7 +9,13 @@ namespace SpecResults.ApprovalTestSuite [Binding] public partial class Steps : ReportingStepDefinitions { - [BeforeTestRun] + private readonly ScenarioContext _scenarioContext; + public Steps(ScenarioContext scenarioContext) + { + _scenarioContext = scenarioContext; + } + + [BeforeTestRun] public static void BeforeTestRun() { Reporters.FixedRunTime = DateTime.MinValue; @@ -52,7 +58,7 @@ public void ThenReportIsGenerated(int p0) [When(@"a step is not implemented")] public void WhenAStepIsNotImplemented() { - ScenarioContext.Current.Pending(); + _scenarioContext.Pending(); } [When] @@ -89,7 +95,7 @@ public void When_a_step_uses_method_name_underscore_style_with_a_table_param_and [When(@"a child step was executed")] public void WhenAChildStepWasExecuted() { - ReportStep(WhenTheTestsRun); + ReportStep(_scenarioContext, WhenTheTestsRun); } [Given(@"a ""(.*)"" scenario is specified with a multi-line argument")] diff --git a/SpecNuts/Extensions.cs b/SpecNuts/Extensions.cs index 430cddd..8b481e3 100644 --- a/SpecNuts/Extensions.cs +++ b/SpecNuts/Extensions.cs @@ -44,7 +44,7 @@ internal static IEnumerable GetPendingSteps(this ScenarioContext scenari { return typeof (ScenarioContext) .GetProperty("PendingSteps", BindingFlags.NonPublic | BindingFlags.Instance) - .GetValue(ScenarioContext.Current, null) as IEnumerable + .GetValue(scenarioContenxt, null) as IEnumerable ?? new string[0]; } diff --git a/SpecNuts/Reporters.SpecFlowHooks.cs b/SpecNuts/Reporters.SpecFlowHooks.cs index a796446..0aaddb3 100644 --- a/SpecNuts/Reporters.SpecFlowHooks.cs +++ b/SpecNuts/Reporters.SpecFlowHooks.cs @@ -64,7 +64,7 @@ internal static void AfterTestRun() } [BeforeFeature] - internal static void BeforeFeature() + internal static void BeforeFeature(FeatureContext featureContext) { var starttime = CurrentRunTime; @@ -89,14 +89,14 @@ internal static void BeforeFeature() foreach (var reporter in reporters) { - var featureId = FeatureContext.Current.FeatureInfo.Title.Replace(" ", "-").ToLower(); + var featureId = featureContext.FeatureInfo.Title.Replace(" ", "-").ToLower(); var feature = new Feature { - Tags = FeatureContext.Current.FeatureInfo.Tags.Select(tag => new Tag() { Name = "@" + tag }).ToList(), + Tags = featureContext.FeatureInfo.Tags.Select(tag => new Tag() { Name = "@" + tag }).ToList(), Elements = new List(), StartTime = starttime, - Name = FeatureContext.Current.FeatureInfo.Title, - Description = FeatureContext.Current.FeatureInfo.Description, + Name = featureContext.FeatureInfo.Title, + Description = featureContext.FeatureInfo.Description, Id = featureId, Uri = $"/{featureId}" }; @@ -109,7 +109,7 @@ internal static void BeforeFeature() } [BeforeScenario] - internal static void BeforeScenario() + internal static void BeforeScenario(ScenarioContext scenarioContext) { var starttime = CurrentRunTime; @@ -117,11 +117,11 @@ internal static void BeforeScenario() { var scenario = new Scenario { - Tags = ScenarioContext.Current.ScenarioInfo.Tags.Select(tag => new Tag() { Name = "@" + tag }).ToList(), + Tags = scenarioContext.ScenarioInfo.Tags.Select(tag => new Tag() { Name = "@" + tag }).ToList(), StartTime = starttime, - Name = ScenarioContext.Current.ScenarioInfo.Title, + Name = scenarioContext.ScenarioInfo.Title, Steps = new List(), - Description = ScenarioContext.Current.ScenarioInfo.Title + Description = scenarioContext.ScenarioInfo.Title }; reporter.CurrentFeature.Elements.Add(scenario); diff --git a/SpecNuts/Reporters.cs b/SpecNuts/Reporters.cs index c68fa95..2193746 100644 --- a/SpecNuts/Reporters.cs +++ b/SpecNuts/Reporters.cs @@ -32,7 +32,7 @@ internal static DateTime CurrentRunTime } } - internal static Step CreateStep(DateTime starttime, MethodBase method, params object[] args) + internal static Step CreateStep(ScenarioContext scenarioContext, DateTime starttime, MethodBase method, params object[] args) { var methodName = method.Name; @@ -40,7 +40,7 @@ internal static Step CreateStep(DateTime starttime, MethodBase method, params ob { Name = ScenarioStepContext.Current.StepInfo.Text, StartTime = starttime, - Keyword = ScenarioContext.Current.CurrentScenarioBlock + " ", + Keyword = scenarioContext.CurrentScenarioBlock + " ", Id = ScenarioStepContext.Current.StepInfo.Text.Replace(" ", "-").ToLower() }; @@ -137,12 +137,12 @@ internal static Step CreateStep(DateTime starttime, MethodBase method, params ob return step; } - internal static async Task ExecuteStep(Func stepFunc, params object[] args) + internal static async Task ExecuteStep(ScenarioContext scenarioContext,Func stepFunc, params object[] args) { - await ExecuteStep(stepFunc, null, args); + await ExecuteStep(scenarioContext, stepFunc, null, args); } - internal static async Task ExecuteStep(Func stepFunc, MethodBase methodBase, params object[] args) + internal static async Task ExecuteStep(ScenarioContext scenarioContext, Func stepFunc, MethodBase methodBase, params object[] args) { methodBase = methodBase ?? stepFunc.Method; @@ -153,7 +153,7 @@ internal static async Task ExecuteStep(Func stepFunc, MethodBase methodBas { currentSteps.Add(reporter, reporter.CurrentStep); - var step = CreateStep(starttime, methodBase, args); + var step = CreateStep(scenarioContext, starttime, methodBase, args); var stepContainer = reporter.CurrentScenario; stepContainer.Steps.Add(step); diff --git a/SpecNuts/ReportingStepDefinitions.cs b/SpecNuts/ReportingStepDefinitions.cs index 9c823d2..9f925ad 100644 --- a/SpecNuts/ReportingStepDefinitions.cs +++ b/SpecNuts/ReportingStepDefinitions.cs @@ -1,13 +1,14 @@ using System; using System.Threading.Tasks; +using TechTalk.SpecFlow; namespace SpecNuts { public abstract class ReportingStepDefinitions : ContextBoundObject { - public async Task ReportStep(Func stepFunc, params object[] args) + public async Task ReportStep(ScenarioContext scenarioContext, Func stepFunc, params object[] args) { - await Reporters.ExecuteStep(stepFunc, args); + await Reporters.ExecuteStep(scenarioContext, stepFunc, args); } } } \ No newline at end of file From 84edd628eaffd8ee1c553dbf978a00b551d5ecbf Mon Sep 17 00:00:00 2001 From: 0x4D616E75 <0x4d616e75@elektronische-nachricht.de> Date: Fri, 22 Mar 2019 20:44:36 +0100 Subject: [PATCH 14/21] fix override of step name and some code cleaning in CreateStep method --- SpecNuts/Reporters.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/SpecNuts/Reporters.cs b/SpecNuts/Reporters.cs index 2193746..8c2e406 100644 --- a/SpecNuts/Reporters.cs +++ b/SpecNuts/Reporters.cs @@ -35,13 +35,14 @@ internal static DateTime CurrentRunTime internal static Step CreateStep(ScenarioContext scenarioContext, DateTime starttime, MethodBase method, params object[] args) { var methodName = method.Name; + var stepInfo = ScenarioStepContext.Current.StepInfo; - var step = new Step + var step = new Step { - Name = ScenarioStepContext.Current.StepInfo.Text, + Name = stepInfo.Text, StartTime = starttime, Keyword = scenarioContext.CurrentScenarioBlock + " ", - Id = ScenarioStepContext.Current.StepInfo.Text.Replace(" ", "-").ToLower() + Id = stepInfo.Text.Replace(" ", "-").ToLower() }; var attr = method.GetCustomAttributes(true).OfType().FirstOrDefault(); @@ -132,8 +133,6 @@ internal static Step CreateStep(ScenarioContext scenarioContext, DateTime startt } } - step.Name = ScenarioStepContext.Current.StepInfo.Text; - return step; } From 6a1bb4ffc004da2c4a1eb07ec1e5f8a7b462a881 Mon Sep 17 00:00:00 2001 From: 0x4D616E75 <0x4d616e75@elektronische-nachricht.de> Date: Fri, 22 Mar 2019 22:15:05 +0100 Subject: [PATCH 15/21] get CreateStep working, if method and args missing --- SpecNuts/Reporters.cs | 53 ++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/SpecNuts/Reporters.cs b/SpecNuts/Reporters.cs index 8c2e406..2f5bd79 100644 --- a/SpecNuts/Reporters.cs +++ b/SpecNuts/Reporters.cs @@ -30,11 +30,19 @@ internal static DateTime CurrentRunTime } return DateTime.Now; } - } - - internal static Step CreateStep(ScenarioContext scenarioContext, DateTime starttime, MethodBase method, params object[] args) + } + + private static void addStepRows(ref Step step, Table table) + { + step.Rows = new List { new Row() { Cells = table.Header.ToList() } }; + foreach (var tableRow in table.Rows) + { + step.Rows.Add(new Row() { Cells = tableRow.Select(x => x.Value).ToList() }); + } + } + + internal static Step CreateStep(ScenarioContext scenarioContext, DateTime starttime, MethodBase method = null, params object[] args) { - var methodName = method.Name; var stepInfo = ScenarioStepContext.Current.StepInfo; var step = new Step @@ -45,7 +53,7 @@ internal static Step CreateStep(ScenarioContext scenarioContext, DateTime startt Id = stepInfo.Text.Replace(" ", "-").ToLower() }; - var attr = method.GetCustomAttributes(true).OfType().FirstOrDefault(); + var attr = method?.GetCustomAttributes(true).OfType().FirstOrDefault(); if (attr != null) { // Handle regex style @@ -59,16 +67,7 @@ internal static Step CreateStep(ScenarioContext scenarioContext, DateTime startt var table = arg as Table; if (table != null) { - - step.Rows = new List { new Row() { Cells = table.Header.ToList() } }; - - foreach (var tableRow in table.Rows) - { - step.Rows.Add(new Row() - { - Cells = tableRow.Select(x => x.Value).ToList() - }); - } + addStepRows(ref step, table); } else { @@ -87,6 +86,7 @@ internal static Step CreateStep(ScenarioContext scenarioContext, DateTime startt } else { + var methodName = method.Name; if (methodName.Contains('_')) { // underscore style @@ -100,15 +100,7 @@ internal static Step CreateStep(ScenarioContext scenarioContext, DateTime startt var table = arg as Table; if (table != null) { - step.Rows = new List { new Row() { Cells = table.Header.ToList() } }; - - foreach (var tableRow in table.Rows) - { - step.Rows.Add(new Row() - { - Cells = tableRow.Select(x => x.Value).ToList() - }); - } + addStepRows(ref step, table); } else { @@ -132,8 +124,17 @@ internal static Step CreateStep(ScenarioContext scenarioContext, DateTime startt } } } - - return step; + else + { + var table = stepInfo.Table; + if(table != null) + { + addStepRows(ref step, table); + } + step.MultiLineParameter = stepInfo.MultilineText; + } + + return step; } internal static async Task ExecuteStep(ScenarioContext scenarioContext,Func stepFunc, params object[] args) From f98f6b0a24e68c7224167c4a7c718cb2f2a47704 Mon Sep 17 00:00:00 2001 From: 0x4D616E75 <0x4d616e75@elektronische-nachricht.de> Date: Fri, 22 Mar 2019 22:19:52 +0100 Subject: [PATCH 16/21] Add hooks to log test steps --- SpecNuts/Extensions.cs | 17 +++++++++- SpecNuts/Reporters.SpecFlowHooks.cs | 50 +++++++++++++++++++++++++++-- 2 files changed, 64 insertions(+), 3 deletions(-) diff --git a/SpecNuts/Extensions.cs b/SpecNuts/Extensions.cs index 8b481e3..5bd1cc4 100644 --- a/SpecNuts/Extensions.cs +++ b/SpecNuts/Extensions.cs @@ -40,7 +40,22 @@ public static TestResult GetResult(this IEnumerable results) return TestResult.passed; } - internal static IEnumerable GetPendingSteps(this ScenarioContext scenarioContenxt) + internal static TestResult ToTestResult(this ScenarioExecutionStatus executionStatus) + { + switch (executionStatus) + { + case ScenarioExecutionStatus.OK: + return TestResult.passed; + case ScenarioExecutionStatus.StepDefinitionPending: + return TestResult.pending; + case ScenarioExecutionStatus.TestError: + return TestResult.failed; + default: + return TestResult.undefined; + } + } + + internal static IEnumerable GetPendingSteps(this ScenarioContext scenarioContenxt) { return typeof (ScenarioContext) .GetProperty("PendingSteps", BindingFlags.NonPublic | BindingFlags.Instance) diff --git a/SpecNuts/Reporters.SpecFlowHooks.cs b/SpecNuts/Reporters.SpecFlowHooks.cs index 0aaddb3..5dedcb1 100644 --- a/SpecNuts/Reporters.SpecFlowHooks.cs +++ b/SpecNuts/Reporters.SpecFlowHooks.cs @@ -2,6 +2,8 @@ using System.Linq; using SpecNuts.Model; using TechTalk.SpecFlow; +using TechTalk.SpecFlow.Bindings; +using TechTalk.SpecFlow.Bindings.Reflection; namespace SpecNuts { @@ -63,7 +65,31 @@ internal static void AfterTestRun() } } - [BeforeFeature] + [AfterStep] + internal static void AfterStep(ScenarioContext scenarioContext) + { + var endtime = CurrentRunTime; + var result = scenarioContext.ScenarioExecutionStatus.ToTestResult(); + var error = scenarioContext.TestError?.ToExceptionInfo().Message; + error = (error == null && result == TestResult.pending) ? new PendingStepException().ToExceptionInfo().Message : string.Empty; + + foreach (var reporter in reporters.ToArray()) + { + var step = reporter.CurrentStep; + step.EndTime = CurrentRunTime; + step.Result = new StepResult + { + Duration = (long)((endtime - reporter.CurrentStep.StartTime).TotalMilliseconds * 1000000), + Status = result, + Error = error + }; + OnFinishedStep(reporter); + reporter.CurrentStep = null; + } + } + + + [BeforeFeature] internal static void BeforeFeature(FeatureContext featureContext) { var starttime = CurrentRunTime; @@ -136,5 +162,25 @@ internal static void BeforeTestRun() { _testrunIsFirstFeature = true; } - } + + [BeforeStep] + internal static void BeforeStep(ScenarioContext scenarioContext) + { + var starttime = CurrentRunTime; + var stepInfo = ScenarioStepContext.Current.StepInfo; + var binding = stepInfo.BindingMatch.StepBinding as StepDefinitionBinding; + var method = binding?.Method as RuntimeBindingMethod; + + foreach (var reporter in reporters) + { + var step = CreateStep(scenarioContext, starttime); + + reporter.CurrentScenario.Steps.Add(step); + reporter.CurrentStep = step; + + OnStartedStep(reporter); + } + } + + } } \ No newline at end of file From 0853f4aedcb262d0c31b17382be7082c6fc1e9e6 Mon Sep 17 00:00:00 2001 From: 0x4D616E75 <0x4d616e75@elektronische-nachricht.de> Date: Fri, 22 Mar 2019 22:38:55 +0100 Subject: [PATCH 17/21] update nuget packages --- .../SpecNuts.ApprovalTestSuite.csproj | 12 ++++++------ SpecNuts.UnitTests/SpecNuts.UnitTests.csproj | 4 ++-- SpecNuts/SpecNuts.csproj | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/SpecNuts.ApprovalTestSuite/SpecNuts.ApprovalTestSuite.csproj b/SpecNuts.ApprovalTestSuite/SpecNuts.ApprovalTestSuite.csproj index 6491e08..1a7c6fc 100644 --- a/SpecNuts.ApprovalTestSuite/SpecNuts.ApprovalTestSuite.csproj +++ b/SpecNuts.ApprovalTestSuite/SpecNuts.ApprovalTestSuite.csproj @@ -72,12 +72,12 @@ - - - - - - + + + + + + diff --git a/SpecNuts.UnitTests/SpecNuts.UnitTests.csproj b/SpecNuts.UnitTests/SpecNuts.UnitTests.csproj index 474ad55..3e1e06e 100644 --- a/SpecNuts.UnitTests/SpecNuts.UnitTests.csproj +++ b/SpecNuts.UnitTests/SpecNuts.UnitTests.csproj @@ -46,8 +46,8 @@ - - + + diff --git a/SpecNuts/SpecNuts.csproj b/SpecNuts/SpecNuts.csproj index 566471f..a435a36 100644 --- a/SpecNuts/SpecNuts.csproj +++ b/SpecNuts/SpecNuts.csproj @@ -71,7 +71,7 @@ - + From 86c68c5a636f75cef7643b3e0b3559777e134e94 Mon Sep 17 00:00:00 2001 From: 0x4D616E75 <0x4d616e75@elektronische-nachricht.de> Date: Mon, 15 Apr 2019 10:33:36 +0200 Subject: [PATCH 18/21] Update Specflow nuget packages to latest version. Now Specflow version isn't beta. --- .../SpecNuts.ApprovalTestSuite.csproj | 8 ++++---- SpecNuts/SpecNuts.csproj | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/SpecNuts.ApprovalTestSuite/SpecNuts.ApprovalTestSuite.csproj b/SpecNuts.ApprovalTestSuite/SpecNuts.ApprovalTestSuite.csproj index 1a7c6fc..6d23864 100644 --- a/SpecNuts.ApprovalTestSuite/SpecNuts.ApprovalTestSuite.csproj +++ b/SpecNuts.ApprovalTestSuite/SpecNuts.ApprovalTestSuite.csproj @@ -74,10 +74,10 @@ - - - - + + + + diff --git a/SpecNuts/SpecNuts.csproj b/SpecNuts/SpecNuts.csproj index a435a36..d917280 100644 --- a/SpecNuts/SpecNuts.csproj +++ b/SpecNuts/SpecNuts.csproj @@ -71,7 +71,7 @@ - + From 9be3355d2950074ee8844771616fbfd52081a60d Mon Sep 17 00:00:00 2001 From: 0x4D616E75 <0x4d616e75@elektronische-nachricht.de> Date: Mon, 15 Apr 2019 15:03:09 +0200 Subject: [PATCH 19/21] Update CI setting to restore nuget packages before build --- appveyor.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 7221a42..5c9ed64 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,3 +1,5 @@ +before_build: + - nuget restore deploy: provider: NuGet api_key: From 75e00a42e768160729c6f8b7bd59ab3aaa71f20d Mon Sep 17 00:00:00 2001 From: 0x4D616E75 <0x4d616e75@elektronische-nachricht.de> Date: Mon, 15 Apr 2019 21:38:12 +0200 Subject: [PATCH 20/21] update appveyor.yml to use VS2017 image --- appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 5c9ed64..ceedbbf 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,6 @@ +image: Visual Studio 2017 before_build: - - nuget restore + - cmd: dotnet restore deploy: provider: NuGet api_key: From ea3a6728d64c85fb3311b221b909ae21868d2d65 Mon Sep 17 00:00:00 2001 From: 0x4D616E75 <0x4d616e75@elektronische-nachricht.de> Date: Mon, 15 Apr 2019 22:11:31 +0200 Subject: [PATCH 21/21] Fix call of async reportStep method in nestedStep test --- SpecNuts.ApprovalTestSuite/Steps.Definitions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SpecNuts.ApprovalTestSuite/Steps.Definitions.cs b/SpecNuts.ApprovalTestSuite/Steps.Definitions.cs index ec61170..dfada6e 100644 --- a/SpecNuts.ApprovalTestSuite/Steps.Definitions.cs +++ b/SpecNuts.ApprovalTestSuite/Steps.Definitions.cs @@ -95,7 +95,7 @@ public void When_a_step_uses_method_name_underscore_style_with_a_table_param_and [When(@"a child step was executed")] public void WhenAChildStepWasExecuted() { - ReportStep(_scenarioContext, WhenTheTestsRun); + ReportStep(_scenarioContext, WhenTheTestsRun).Wait(); } [Given(@"a ""(.*)"" scenario is specified with a multi-line argument")]