I'm working with a project and I'm planning to use Specflow and Selenium C#. I'm new with using Specflow (SpecFlow is the open source port of Cucumber for .NET) for automation and I'm going to use it for regression testing of an existing website. I'm just curious if a single feature file should cover all the regression test cases or would it be better to create a feature per tab?

I'm just concern with code duplication as creating a featue per tab would share the same background of "Given that I'm on the web page".

Our current manual test steps look like this:

  1. Patient Info Tab

    • Edit Patient Info
    • Update Contact Preferences
  2. Physician Verification Tab

    • Physician Search
    • Edit Physician Info
  • Please ask the csv / data-driven question separately so each can be answered and available for others without the other details. Jul 19, 2017 at 18:49
  • Also this sounds more like "how can I organize my Specflow test cases" rather than "design a Specflow automated Framework" ? You're using a framework not designing one, right? Just looking to improve the question to get you better answers :) Jul 19, 2017 at 18:51

2 Answers 2


I would consider breaking it up into Patient Info and Physician Verification.

You mention tabs - can these windows be accessed separately? I would try and treat them separately in separate specs if at all possible.

  • Hi Michael, yup they can be accessed separately. Thank you for your suggestion. I just thought that since a single feature could contain multiple scenarios I was just gonna put all the regression test case in a single file but still use Page Object Model pattern for every tab and window that opens.
    – Mr. Auto
    Jul 19, 2017 at 19:15

Its not actually duplication that's happening , its more of Code Reuse. You state the scenarios in your .feature file and define the test cases using

Given .... 
When .... 
Then ....

constructs. Specflow generator binds each step with a function(in C#) which is implemented in a .cs file. No matter how many times a step is being repeated , its referring the same function to which it is binded. Moreover while testing a UI you cannot possibly eliminate repetition of certain steps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.