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 908077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:39:31+00:00 2026-05-15T16:39:31+00:00

Is it better to specify all the parameters of a given in one line,

  • 0

Is it better to specify all the parameters of a given in one line, or each parameter on a seperate line? i.e. which is better?

seperate And for each parameter

Scenario: some random scenario
 Given a menu with a menu width of 19 
 And quit text of "quit" 
 And Fruit options of 
  |Text|
     |some text|
     When ...
     Then ...

or all the paremters for the specific Given on one line

Scenario: Some scenario
 Given a menu with  quit text of "quit" and menu width of 19 and Fruit options of 
  |Text|
     |Some text|
    When ... 
 Then ...

This appears (and I hope I’m wrong) to have the following implications for how you write your bindings, as well as starts to influence how you write your class, which it shouldnt! i.e. first option (seperate AND for each parameter ) the binding is easier to write if your class has public properties that are set one by one after the object is created…

private Menu _menu;
[Given(@"a menu of fruit options")]
public void GivenAMenuOfFruitOptions(Table table)
{
    string[] fruitOptions = table.GetColumn("Fruit");
    _menu = new Menu(fruitOptions,null);
}

[Given(@"a menu width of (.*)")]
public void GivenAMenuWidthOf(string width)
{
    _menu.Width = int.Parse(width);
}

[Given(@"a Quite text of ""(.*)""")]
public void GivenAMenuWidthOf(string quitText)
{
    _menu.QuitText = quitText;
}

whereas option two ( all on one line) it’s easier to have an object with a constructor that takes all the parameters as constructor arguments.

private Menu _menu;
[Given(@"a menu with  quit text of ""(.*)"" and menu width of (\d+) and Fruit options of ")]
public void GivenAMenuOfFruitOptions(string quitText, int width, Table table)
{
    string[] fruitOptions = table.GetColumn("Fruit");
    _menu = new Menu(fruitOptions,width, quitText);
}

I feel as if I’m missing something, because the implementation of specflow should not influence the code I write, and I’m worried that #1 above will encourage overly stateful objects. I’m a functional stateless addict.

Any pointers will be most helpful.

txs in advance,

cheers, Alan

  • 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-05-15T16:39:31+00:00Added an answer on May 15, 2026 at 4:39 pm

    I am writing BDD style tests and I am using the first method because…

    1. The setup methods (also for verification) might get reused in related tests.
    2. Any failing tests will highlight the exact method that fails, including setup.
    3. Eliminates duplication for related tests and thus will be easier to maintain.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm setting up a search system which has urls eg. all parameters are optional
I'd like to know is it better to specify a default initialization for a
Which is more better , powerful and flexible between Graphiti or Draw2D, As i
According to the MSDN , you can specify an access type parameter to InternetOpen.
Is it better practice to specify a relative address in an endpoint for example
I have a model Goal that has four types of children (which all have
I'm developing a Python application; it has all its code in one package and
The title really says it all: what is the difference between minus one and
Enum.Format (or <enum>.ToString()) has an optional format parameter that allows you to specify different
I have a fields_for tag, where I specify the prefix (lets say for some

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.