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

  • SEARCH
  • Home
  • 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 8948249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:56:25+00:00 2026-06-15T12:56:25+00:00

At present we have this step: [When(@I set the scenario price for product (.*)

  • 0

At present we have this step:

[When(@"I set the scenario price for product (.*) to (.*)")]
public void WhenISetTheScenarioPriceForProductPToN(string product, string priceStr)

I wish to add the step:

[When(@"I set the scenario price for product (.*) to (.*) in the (.*) zone")
public void WhenISetTheScenarioPriceInZoneForProductPToN(string product, string priceStr, string zone)

However spec flow gives an “Ambiguous step definitions found for step” error between the two steps.

I have tired:

  [When(@"I set the scenario price for product (.*) to (.*) in the (.*) zone")]
  [When(@"I set the scenario price for product (.*) to (.*)")]
  public void WhenISetTheScenarioPriceInZoneForProductPToN(string product, string priceStr, string zone)

but that fails with a “binding error: Parameter count mismatch!” I was hopeing it would pass null for the 2nd “when”.

  • 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-15T12:56:26+00:00Added an answer on June 15, 2026 at 12:56 pm

    The problem is second your (.*). That can expand to match “xyz in the abc zone”. Can you instead match just a single word? i.e. (\w+)

    [When(@"I set the scenario price for product (.*) to (\w+)")]
    

    That would then prevent the shorter Regex matching in the abc zone as well.

    You can test this by commenting out your longer When attribute and method and debugging to see what matches the shorter one.

    Also, you always have to have the same number of Regexes as parameters which is why the combined one doesn’t work.


    This did not work for me, this is due to a price of “0.99” and “.” not being matched by \w. However this works:

    [When(@"I set the scenario price for product (.*) to (\S+)")]
    public void WhenISetTheScenarioPriceForProductPToN(string product, string priceStr)
    

    as our “test values” don’t have spaces in them.

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

Sidebar

Related Questions

Present Scenario : I have a set of classes that all take a common
This is the required behaviour: I have various controls present on the canvas e.g.
I have an ordered string that I need to present to a user: ABCCDDCBBBCBBDDBCAAA
I have this code below. How can I set a cell value to =
I have this The body: <body><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent
How can I prevent caching on exception? I have this action: caches_page :index ...
At present I have a TestNG project that calls a JBoss RESTEasy web service.
At present we have a denormalised database. ie Name|NameID|EmployeeID|EmployeeType I'm normalising the database to
Tomorrow I have an exam for a C programming and we have to present
I have a tableView that present a list of Books, each of the table

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.