SoftwareTestPilot
25 SpecFlow Q&A

Top 25 SpecFlow Interview Questions with Answers (1970) — .NET BDD Edition

The exact 25-question set for SpecFlow interviews in 2026. BDD, Gherkin, step definitions, hooks, table transformations, and LivingDoc — with concise C# code samples interviewers expect.

  • 4 min read
  • Difficulty: Beginner → Intermediate
  • 1–5 yrs
  • Updated June 1970
  • Avinash Kamble

1. BDD & Gherkin Fundamentals

Easy Very Common 1 min read

Q1.What is SpecFlow?

SpecFlow is the .NET port of Cucumber. It lets .NET developers write Gherkin feature files and bind them to C# step definitions. See our SpecFlow C# Automation Guide for a full walkthrough.

Easy Very Common 1 min read

Q2.What is BDD?

Behavior-Driven Development is a methodology that uses executable specifications in plain language (Given–When–Then) to align developers, testers, and business stakeholders on what to build.

Medium Very Common 1 min read

Q3.What is Gherkin?

Gherkin is the plain-text language with the keywords Feature, Scenario, Given, When, Then, And, But. SpecFlow and Cucumber both use the same Gherkin syntax.

Easy Very Common 1 min read

Q4.What's the difference between Given, When, and Then?

  • Given — state before the action ("I am logged in").
  • When — the action ("I click submit").
  • Then — the expected outcome ("I should see…").
Medium Very Common 1 min read

Q5.What is a Feature file?

A .feature file is a plain-text file written in Gherkin syntax. Place it in the Features/ folder of your project. SpecFlow generates a code-behind file that hooks scenarios into the test runner.

Confidence check

If you can confidently answer the BDD & Gherkin Fundamentals questions above, you're well prepared for this section of your interview. Move on, or rehearse the trickier ones aloud with our AI mock interviewer.

2. Step Definitions & Bindings

Medium Very Common 1 min read

Q6.What is a step definition?

A C# method annotated with [Given], [When], or [Then] and a regex (or cucumber expression) that matches the Gherkin step.

[When(@"I enter ""(.*)"" as the email")]
public void WhenIEnterEmail(string email) { /* ... */ }
Easy Very Common 1 min read

Q7.What is the [Binding] attribute?

Tells SpecFlow that a class contains step definitions or hooks. Required on any class with step methods, otherwise SpecFlow will not discover them.

Confidence check

If you can confidently answer the Step Definitions & Bindings questions above, you're well prepared for this section of your interview. Move on, or rehearse the trickier ones aloud with our AI mock interviewer.

3. Scenarios, Data Tables & Transformations

Medium Very Common 1 min read

Q8.What is a Scenario Outline?

A template scenario with multiple data sets in an Examples table:

Scenario Outline: Login
  When I enter "<email>" as the email
  Then I should see "<greeting>"
Examples:
  | email             | greeting       |
  | admin@example.com | Welcome, admin |
Medium Very Common 1 min read

Q9.What is a Data Table?

A table passed to a single step for data-driven scenarios:

When I apply the following codes:
  | code    | discount |
  | WELCOME | 10%      |
Medium Common 1 min read

Q10.What is a table transformation?

Convert a Gherkin table to a typed C# collection:

[StepArgumentTransformation]
public IEnumerable<PromoCode> TransformPromoCodes(Table table) =>
    table.CreateSet<PromoCode>();
Confidence check

If you can confidently answer the Scenarios, Data Tables & Transformations questions above, you're well prepared for this section of your interview. Move on, or rehearse the trickier ones aloud with our AI mock interviewer.

4. Hooks & Scenario Context

Medium Common 1 min read

Q11.What are Hooks in SpecFlow?

Methods that run before/after scenarios, features, or the test run:

[BeforeScenario]
public void BeforeScenario() { /* setup */ }

[AfterScenario]
public void AfterScenario() { /* cleanup */ }
Medium Common 1 min read

Q12.What is the difference between [BeforeScenario] and [BeforeFeature]?

  • [BeforeScenario] — runs before every scenario.
  • [BeforeFeature] — runs once per feature file.
  • [BeforeTestRun] — runs once before the entire suite.
Medium Common 1 min read

Q13.How do you tag scenarios and run by tag?

@smoke @critical
Scenario: Login
dotnet test --filter:"TestCategory=smoke"
Medium Common 1 min read

Q14.What is ScenarioContext?

ScenarioContext lets you share state between steps within one scenario — typically used for the WebDriver instance, test data, or anything that has to cross step boundaries. Prefer context injection over static fields for thread safety.

Confidence check

If you can confidently answer the Hooks & Scenario Context questions above, you're well prepared for this section of your interview. Move on, or rehearse the trickier ones aloud with our AI mock interviewer.

5. Tags, Tooling & LivingDoc

Easy Common 1 min read

Q15.What's the difference between SpecFlow and Reqnroll?

Reqnroll is a 2024 community fork of SpecFlow. For greenfield projects, evaluate both. For existing SpecFlow projects, stay on SpecFlow unless you have a concrete reason (e.g. faster release cadence) to migrate.

Easy Common 1 min read

Q16.What is SpecFlow+ LivingDoc?

A tool that generates human-readable HTML documentation from feature files. It publishes the executable specification of your system — perfect for stakeholders who don't read code.

Medium Common 1 min read

Q17.How do you generate step definitions in Visual Studio?

Right-click the .feature file → Generate Step Definitions. SpecFlow creates a stub class with each step as a method to implement.

Easy Common 1 min read

Q18.What test runners does SpecFlow support?

SpecFlow 3.9+ supports NUnit, xUnit, and MSTest. NUnit is the most popular choice in .NET QA shops in 2026.

Confidence check

If you can confidently answer the Tags, Tooling & LivingDoc questions above, you're well prepared for this section of your interview. Move on, or rehearse the trickier ones aloud with our AI mock interviewer.

6. Advanced Patterns & Integration

Medium Occasional 1 min read

Q19.How do you handle dynamic data in steps?

Use [StepArgumentTransformation] to convert Gherkin arguments to typed values:

[StepArgumentTransformation(@"(\d+) days ago")]
public DateTime DaysAgo(int days) => DateTime.UtcNow.AddDays(-days);
Easy Occasional 1 min read

Q20.How do you share state across step classes?

Use the SpecFlow context-injection pattern. Create a POCO context class and inject it into step classes via constructor — SpecFlow's container resolves the same instance per scenario.

Medium Occasional 1 min read

Q21.Can SpecFlow run scenarios in parallel?

Yes — via NUnit's [Parallelizable] attribute. SpecFlow parallelises at the feature-file level by default. Make sure WebDrivers and contexts are per-scenario (no statics).

Medium Occasional 1 min read

Q22.What's the best way to handle authentication in SpecFlow?

Use a Background step or a custom hook to log in once per scenario:

Background:
  Given I am logged in as "admin@example.com"
Medium Occasional 1 min read

Q23.How do you integrate SpecFlow with Selenium?

Create a DriverFactory that returns an IWebDriver, store it in ScenarioContext, and inject it into step definitions via constructor. See our Selenium Q&A bank for related patterns.

Confidence check

If you can confidently answer the Advanced Patterns & Integration questions above, you're well prepared for this section of your interview. Move on, or rehearse the trickier ones aloud with our AI mock interviewer.

7. Versions & Comparisons

Easy Occasional 1 min read

Q24.What is the current version of SpecFlow in 2026?

SpecFlow 3.9.x supports .NET 6, 7, 8, and 9. Use the latest 3.9.x release for the best .NET 8/9 experience.

Easy Occasional 1 min read

Q25.What's the difference between SpecFlow and Cucumber-JVM?

Same Gherkin syntax, different binding languages. SpecFlow = C#/.NET. Cucumber-JVM = Java. Scenarios written in one can be ported to the other with minimal effort.

Confidence check

If you can confidently answer the Versions & Comparisons questions above, you're well prepared for this section of your interview. Move on, or rehearse the trickier ones aloud with our AI mock interviewer.

Quick revision

  1. Q1: What is SpecFlow — SpecFlow is the .NET port of Cucumber.
  2. Q2: What is BDD — Behavior-Driven Development is a methodology that uses executable specifications in plain language (Given–When–Then) to align developers, testers, and business stakeholders on what
  3. Q3: What is Gherkin — Gherkin is the plain-text language with the keywords Feature , Scenario , Given , When , Then , And , But .
  4. Q4: What's the difference between Given, When, and Then — Given — state before the action ("I am logged in").
  5. Q5: What is a Feature file — A .feature file is a plain-text file written in Gherkin syntax.

Frequently asked questions

Yes — SpecFlow 3.9+ is actively maintained and remains the default BDD framework for .NET teams.

Learn SpecFlow if you're in a .NET shop. Learn Cucumber if you're in a Java/JS/Python shop. Both use the same Gherkin syntax, so skills transfer.

Recommended but not required. Rider and VS Code also work with the SpecFlow extension. Visual Studio has the best Gherkin IntelliSense and step-linking.

Yes — via SpecFlow+ LivingDoc. The reports show every feature, scenario, step result, and trend over time.

Was this article helpful?

Key takeaways

  • Master the fundamentals before tackling advanced SpecFlow scenarios.
  • Always explain trade-offs — interviewers reward judgement, not memorisation.
  • Use real project examples; generic answers blend in.
  • Practice answers out loud — written prep doesn't transfer to live rounds.
  • Revise the 30-second cheat sheet the night before your interview.
  • Keep one strong scenario story ready for every section above.
Home