SpecFlowOSS / SpecFlow

#1 .NET BDD Framework. SpecFlow automates your testing & works with your existing code. Find Bugs before they happen. Behavior Driven Development helps developers, testers, and business representatives to get a better understanding of their collaboration
https://www.specflow.org/
Other
2.24k stars 754 forks source link

And statement not recognized #1236

Closed Sl1ckR1ck closed 3 years ago

Sl1ckR1ck commented 6 years ago

SpecFlow Version: 2.4

Used Test Runner

Version number:

Visual Studio Version

Are the latest Visual Studio updates installed?

.NET Framework:

Test Execution Method:

<SpecFlow> Section in app.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow" />
  </configSections>
  <specFlow>
    <!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config -->
  <!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config --><unitTestProvider name="MsTest" /></specFlow>
</configuration>

Repro Project

Hi, Im new with Specflow, so i may be doing something wrong.

I have the following feature file:


Feature: KeySecurity
    In order to ensure that no authorized access occurs
    As a SES employee
    I want to be ensure that only users with the proper license is able to open a given application

@Generic @License
Scenario: A user with the proper license is able to open the application
    Given I have a license which can run the application
    When I open the application
    Then the application opens without any security message

# Generic Test Case 4.1.1 
@Generic @License
Scenario Outline: A user with an invalid key configured but with many defined network keys trying to open the application should be presented a security message
    Given the application language is in <UILanguage>
    And I have an invalid key configured but with many defined network keys
    When I open the application
    Then a network key security message is presented to the user with an error message in <UILanguage>

Examples: 
    | UILanguage |
    | en         |
    | zh         |

# Generic Test Case 4.1.2 
@Generic @License
Scenario: A user with an invalid key configured but with many defined network keys can start the application in demo mode
    Given I have an invalid key configured but with many defined network keys
    When I open the application and select demo mode in the security message
    Then the application opens in demo mode

# Generic Test Case 4.1.3 
@Generic @License
Scenario Outline: A user with an invalid key configured without any defined network keys trying to open the application should be presented a security message
    Given the application language is in <UILanguage>
    And I have an invalid key configured without any defined network keys    #<--PROBLEM HERE 
    When I open the application
    Then a local key security message is presented to the user with an error message in <UILanguage>

Examples: 
    | UILanguage |
    | en         |
    | zh         |

All the steps are bound properly but the last And statement in the last scenario outline create a code generation error: (38:2): expected : #EOF, #TableRow, #DocStringSeparator, #StepLine, #TagLine, #ExamplesLine, #ScenarioLine, #ScenarioOutlineLine, #Comment, #Empty, got 'And I have an invalid key configured without any defined network keys'

If i remove the And statement the code generates properly.

I do have a proper binding:

    <TechTalk.SpecFlow.Given("I have an invalid key configured without any defined network keys")>
    Public Sub GivenIHaveAnInvalidKeyConfiguredWithoutAnyDefinedNetworkKeys()

... End Sub

What am i doing wrong here?

Sl1ckR1ck commented 6 years ago

Oh well will writting the issue i found the problem, in VS the space between the 'And' and the text seemed to be using a tab (but was shown as a space)

By pasting the code here i saw the weird spacing... so i tried to remove and reenter the space again. Voila, everything work now...

Weird bug...

SabotageAndi commented 6 years ago

@Sl1ckR1ck could you create a small repro project with this issue? With the copy and paste feature file and markdown formatting, I am not sure if everything is the same if I copy it out of the issue.

Thanks!

SabotageAndi commented 3 years ago

Closed because of inactivity

github-actions[bot] commented 3 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.