Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8648285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:16:44+00:00 2026-06-12T13:16:44+00:00

Using scenario outlines in SpecFlow, e.g. Scenario Outline: Invalid Login Details Given some pre-conditions…

  • 0

Using scenario outlines in SpecFlow, e.g.

Scenario Outline: Invalid Login Details

Given some pre-conditions...
When user "Larry" enters username <username> and password <password>
Then the message "Invalid Login Details" should be displayed

Examples:
|username|password|
|larry06 |        |
|larry06 |^&*%*^$ |
|%^&&**  |pass123 |
|        |pass123 |

I expected that the “When” step would be evaluated as such:

public void WhenUserEntersUsernameAndPassword(String username, String password){}

And that the scenario would be run 4 times – for each row of the table, passing the values as required. That’s not the case.

Instead, SpecFlow creates 1 of 4 required step definitions:

[When(@"""(.*)"" provides the following new username larry(.*) and password ")]
public void WhenUserEntersUsernameLarryAndPassword(string p0, int p1)
{
//TODO
}

And to get the remaining 3 to ‘work’ I need to manually write methods explicitly matching other values in the table.

I’ve since realised that I can just say:

When "Larry" enters username "<username>" and password "<password>"

And I get:

[When(@"""(.*)"" provides the following ""(.*)"" and ""(.*)""")]
public void WhenUserEntersUsernameAndPassword(string p0, string name, string pass)
{
//TODO
}

Perfect.

But all documentation seems to suggest I don’t need “” and that should just work (e.g. https://github.com/cucumber/cucumber/wiki/Scenario-outlines). I note:

“Your step definitions will never have to match a placeholder. They will need to match the values that will replace the placeholder”

I just don’t really see the value of writing separate step definitions for each line of the table.

Is this nuance specific to SpecFlow?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T13:16:45+00:00Added an answer on June 12, 2026 at 1:16 pm
    When "Larry" enters username <username> and password <password>
    

    will match

    [When(@"""(.*)"" enters username (.*) and password (.*)")]
    public void WhenEntersUsernameAndPassword(string p0, string name, string pass)
    {
    //TODO
    }
    

    so the documentation is fine.

    The problem you experienced is that the auto generation of step text doesn’t anticipate what regexs to insert without the "..." – which I guess it must be using as an indicator that you are passing interchangable strings – matchable with “(.*)”, but if you don’t want the quotes, you can still manually correct it just fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Scenario first :- I'm using Entity Framework to do some queries, to build my
Very common scenario using Ajax is to parse the response and create the user
I'd like to know what happens given the following scenario using the .net client.
I am using a scenario table ( multiline step arguments ) to check some
The Scenario Using jQuery, I have a page that has a popup overlay containing
I'm trying to implement this scenario using Unity and i can't figure out how
Hey, This is my scenario: Using visual studio 2008. Project is in c# Using
Scenario While using the Maven Ant Task artifact:deploy , I'm encountering the error java.lang.OutOfMemoryError:
The Scenario I am using PHP's SimpleXML to parse a blog feed. The most
The scenario I am using LINQ is as follows: I have a method that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.