Using Background in SpecFlow V2.4 causes a failure to build behind code file

127 views
Skip to first unread message

aceroraptor

unread,
Aug 23, 2018, 8:38:32 AM8/23/18
to SpecFlow
Hi,

Using the latest SpecFlow v2.4 with a Background(it was white and not the expected Blue).  Results in a failure to generate the behind code file for my feature file.
On one occasion I got an exception; see ActivityLog entry and attached error pop up.

Feature file snippet

Feature: NSV001_RouteUnderThreshold

@newShareVelocity: 

Background: 
    Given I update "Market Access" file with:
| Environment | RouteName                 | RouteGroup | Limit | SpeedBump |
| IDX               | MSPOOL_GEB6_IDX | Small             |     | 14000000     |

Scenario: CAS does not Generate an NSV Alert when HiFlow total shares below threshold 
..........


Generated code behind file:NSV001_RouteUnderThreshold.feature.cs
#error (8:1): expected: #TagLine, #ScenarioLine, #ScenarioOutlineLine, #Comment, #Empty, got 'Background:'
#error (9:5): expected: #TagLine, #ScenarioLine, #ScenarioOutlineLine, #Comment, #Empty, got 'Given I update "Market Access" file with:'
#error (10:3): expected: #TagLine, #ScenarioLine, #ScenarioOutlineLine, #Comment, #Empty, got '| Environment | RouteName       | RouteGroup | Limit | SpeedBump |'
#error (11:3): expected: #TagLine, #ScenarioLine, #ScenarioOutlineLine, #Comment, #Empty, got '| IDX         | MSPOOL_GEB6_IDX | Small      | 0     | 14000000  |'


ActivityLog XML 
<entry>
    <record>559</record>
    <time>2018/08/22 17:12:43.767</time>
    <type>Error</type>
    <source>Editor or Editor Extension</source>
    <description>System.NullReferenceException: Object reference not set to an instance of an object.&#x000D;&#x000A;   at TechTalk.SpecFlow.VsIntegration.EditorCommands.FormatTableCommand.FormatTable(GherkinEditorContext editorContext)&#x000D;&#x000A;   at TechTalk.SpecFlow.VsIntegration.EditorCommands.EditorCommandFilter.PostExec(GherkinEditorContext editorContext, Guid pguidCmdGroup, UInt32 nCmdID, IntPtr pvaIn)&#x000D;&#x000A;   at TechTalk.SpecFlow.VsIntegration.EditorCommands.GherkinTextViewCreationListener.EditorCommandFilterInstance.Exec(Guid&amp; pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)&#x000D;&#x000A;   at Microsoft.VisualStudio.Editor.Implementation.CommandChainNode.InnerExec(Guid&amp; pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)&#x000D;&#x000A;   at Microsoft.VisualStudio.Editor.Implementation.CommandChainNode.Exec(Guid&amp; pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)&#x000D;&#x000A;   at TechTalk.SpecFlow.VsIntegration.AutoComplete.CompletionCommandFilter.Exec(Guid&amp; pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)&#x000D;&#x000A;   at Microsoft.VisualStudio.Editor.Implementation.CommandChainNode.InnerExec(Guid&amp; pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)&#x000D;&#x000A;   at Microsoft.VisualStudio.Editor.Implementation.SimpleTextViewWindow.Exec(Guid&amp; pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)&#x000D;&#x000A;   at Microsoft.VisualStudio.Editor.Implementation.VsKeyboardFilter.SendCommand(Guid cmdGroup, UInt32 cmdID, Object inParam)&#x000D;&#x000A;   at Microsoft.VisualStudio.Editor.Implementation.VsKeyboardFilter.TextInput(TextCompositionEventArgs args)&#x000D;&#x000A;   at Microsoft.VisualStudio.Text.Editor.Implementation.KeyProcessorDispatcher.&lt;&gt;c.&lt;DispatchTextInputEvents&gt;b__6_0(KeyProcessor p, TextCompositionEventArgs args)&#x000D;&#x000A;   at Microsoft.VisualStudio.Text.Editor.Implementation.KeyProcessorDispatcher.&lt;&gt;c__DisplayClass10_1`1.&lt;Dispatch&gt;b__0()&#x000D;&#x000A;   at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.CallExtensionPoint(Object errorSource, Action call)</description>
  </entry>


PACKAGES installed

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Common.Logging" version="3.4.1" targetFramework="net461" />
  <package id="Common.Logging.Core" version="3.4.1" targetFramework="net461" />
  <package id="Common.Logging.NLog20" version="3.3.1" targetFramework="net461" />
  <package id="Microsoft.CSharp" version="4.5.0" targetFramework="net461" />
  <package id="Newtonsoft.Json" version="11.0.2" targetFramework="net461" />
  <package id="NLog" version="4.5.8" targetFramework="net461" />
  <package id="NUnit" version="3.10.1" targetFramework="net461" />
  <package id="NUnit.Engine" version="3.8.0" targetFramework="net461" />
  <package id="NUnit3TestAdapter" version="3.10.0" targetFramework="net461" />
  <package id="SpecFlow" version="2.4.0" targetFramework="net461" />
  <package id="SpecFlow.CustomPlugin" version="2.4.0" targetFramework="net461" />
  <package id="System.ValueTuple" version="4.5.0" targetFramework="net461" />
</packages>




VisualStudioExceptionNotification.png

Andreas Willich

unread,
Aug 23, 2018, 8:52:29 AM8/23/18
to spec...@googlegroups.com
I think tags are not allowed between the Feature title and the Background.
Feature tags are defined before the feature title.

This could also break the formatting code for the table, because it can't parse the feature file.

If it's not the tag, please create an issue at https://github.com/techtalk/SpecFlow/issues

Thanks!
Andi


--
You received this message because you are subscribed to the Google Groups "SpecFlow" group.
To unsubscribe from this group and stop receiving emails from it, send an email to specflow+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages