SoftwareTestPilot
30 Q&A

SpecFlow Interview Questions & Answers (2026): 30+ BDD Questions for QA Engineers

30+ SpecFlow interview questions for 2026 — Gherkin syntax, bindings, hooks, scenario outlines, data tables, dependency injection and migration to Reqnroll. Real answers with C# code.

  • 4 min read
  • Difficulty: Mixed (Easy → Hard)
  • Freshers → Experienced
  • Updated June 26, 2026
  • Avinash Kamble

1. BDD & SpecFlow Basics

Easy Very Common 1 min read

Q1.What is BDD?

Behaviour-Driven Development is a collaborative practice where business, dev and QA describe behaviour in plain English (Gherkin) before code is written. The same file becomes living documentation and an automated test.

Medium Very Common 1 min read

Q2.What is SpecFlow?

SpecFlow is the open-source BDD framework for .NET. It parses Gherkin .feature files and binds each step to a C# method, then runs the scenarios through NUnit, xUnit or MSTest.

Easy Very Common 1 min read

Q3.Difference between SpecFlow and Cucumber?

Cucumber is for Ruby/Java/JS; SpecFlow is the .NET port. Gherkin syntax is identical — only the step-definition language differs.

Easy Very Common 1 min read

Q4.Is SpecFlow being deprecated?

The original SpecFlow project is in maintenance. The active community fork is Reqnroll, which is API-compatible — your feature files and most step bindings work unchanged.

Confidence check

If you can confidently answer the BDD & SpecFlow Basics 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. Gherkin Syntax

Medium Very Common 1 min read

Q5.What are the core Gherkin keywords?

Feature, Background, Scenario, Scenario Outline, Examples, Given, When, Then, And, But.

Medium Very Common 1 min read

Q6.Sample feature file?

Feature: Login
  As a registered user
  I want to sign in
  So that I can access my dashboard

  Scenario: Valid credentials
    Given I am on the login page
    When I sign in as "user@test.com" with password "Valid@123"
    Then I should land on the dashboard
Easy Very Common 1 min read

Q7.What is a Background?

A set of steps run before every scenario in a feature — typically navigation or setup. Keeps scenarios DRY.

Medium Very Common 1 min read

Q8.Scenario vs Scenario Outline?

A Scenario runs once. A Scenario Outline runs once per row in its Examples table — perfect for data-driven tests.

Confidence check

If you can confidently answer the Gherkin Syntax 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. Step Definitions & Bindings

Medium Very Common 1 min read

Q9.What is a step definition?

A C# method decorated with [Given], [When] or [Then] that maps to a Gherkin step.

[When(@"I sign in as ""(.*)"" with password ""(.*)""")]
public void WhenISignIn(string email, string pwd) =>
    _loginPage.SignIn(email, pwd);
Easy Very Common 1 min read

Q10.What is the [Binding] attribute?

It marks a class as containing step definitions so SpecFlow discovers it during test discovery.

Medium Very Common 1 min read

Q11.Regex vs cucumber expressions?

SpecFlow supports both. Cucumber expressions ({string}, {int}) are easier to read; regex gives finer control.

Medium Common 1 min read

Q12.How are parameters passed?

Captured groups in the regex become method arguments, converted via built-in transforms or your own [StepArgumentTransformation].

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.

4. Hooks & Lifecycle

Medium Common 1 min read

Q13.What are SpecFlow hooks?

Lifecycle attributes: [BeforeTestRun], [BeforeFeature], [BeforeScenario], [BeforeStep] and their After* counterparts.

Easy Common 1 min read

Q14.Order of execution?

TestRun → Feature → Scenario → Step (top-down for Before, bottom-up for After).

Medium Common 1 min read

Q15.How do you scope hooks with tags?

[BeforeScenario("@smoke")]
public void OnlySmoke() { … }
Confidence check

If you can confidently answer the Hooks & Lifecycle 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. Data Tables & Scenario Outlines

Medium Common 1 min read

Q16.How do you pass a table to a step?

Given the following users exist
  | name  | role  |
  | Asha  | admin |
  | Ravi  | user  |
[Given(@"the following users exist")]
public void Given(Table table) {
  var users = table.CreateSet<User>();
}
Medium Common 1 min read

Q17.Scenario Outline example?

Scenario Outline: Invalid login
  When I sign in as "<email>" with password "<pwd>"
  Then I should see "<error>"

  Examples:
    | email          | pwd     | error               |
    | bad@test.com   | wrong   | Invalid credentials |
    |                | x       | Email is required   |
Confidence check

If you can confidently answer the Data Tables & Scenario Outlines 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. Context & Dependency Injection

Medium Common 1 min read

Q18.How do you share state between steps?

Use ScenarioContext (key/value) or, preferred, constructor injection — SpecFlow's container resolves shared classes per scenario.

public class LoginSteps {
  private readonly TestContext _ctx;
  public LoginSteps(TestContext ctx) => _ctx = ctx;
}
Medium Common 1 min read

Q19.ScenarioContext vs FeatureContext?

ScenarioContext is reset per scenario; FeatureContext lives for the whole feature. Prefer DI over both.

Easy Common 1 min read

Q20.Can you plug in your own DI container?

Yes — SpecFlow.Autofac, SpecFlow.Microsoft.Extensions.DependencyInjection, etc.

Confidence check

If you can confidently answer the Context & Dependency Injection 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. Test Runners & Execution

Easy Common 1 min read

Q21.Which runners does SpecFlow support?

NUnit, xUnit, MSTest and SpecFlow+ Runner (deprecated). Pick based on your existing .NET test stack.

Medium Common 1 min read

Q22.How do you run tests in parallel?

Enable parallel execution at the assembly level ([assembly: Parallelizable(ParallelScope.Fixtures)] in NUnit). Ensure step definitions and POMs are scenario-scoped, not static.

Medium Occasional 1 min read

Q23.How do you filter by tag?

dotnet test --filter "TestCategory=smoke"
Confidence check

If you can confidently answer the Test Runners & Execution 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.

8. Reporting & Living Documentation

Medium Occasional 1 min read

Q24.How do you generate reports?

SpecFlow+ LivingDoc generates HTML reports from TestExecution.json:

livingdoc test-assembly bin/Debug/Tests.dll -t TestExecution.json
Medium Occasional 1 min read

Q25.How do you integrate with CI?

Run dotnet test in GitHub Actions / Azure DevOps, publish TRX and LivingDoc artifacts, and gate the PR on green.

Confidence check

If you can confidently answer the Reporting & Living Documentation 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.

9. Advanced Topics

Medium Occasional 1 min read

Q26.How do you handle async steps?

Make the binding public async Task:

[When(@"I load the dashboard")]
public async Task WhenLoad() => await _page.GotoAsync("/dashboard");
Medium Occasional 1 min read

Q27.How do you migrate from SpecFlow to Reqnroll?

Install the Reqnroll NuGet packages, remove SpecFlow packages, update using SpecFlow.* to using Reqnroll.*, and re-generate code-behind files.

Medium Occasional 1 min read

Q28.How do you call APIs in step definitions?

Inject HttpClient via DI and use it inside steps — the same pattern works for RestSharp, covered in our RestSharp guide.

Confidence check

If you can confidently answer the Advanced Topics 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.

10. Common Pitfalls & Best Practices

Easy Occasional 1 min read

Q29.Behavioural vs imperative Gherkin?

Behavioural: "When I sign in as an admin". Imperative: "When I type X in field Y and click Z". Always prefer behavioural — interviewers test for this.

Easy Occasional 1 min read

Q30.When would you NOT use BDD?

Tiny solo projects, throwaway scripts, or pure unit tests. The collaboration cost outweighs the value.

Confidence check

If you can confidently answer the Common Pitfalls & Best Practices 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 BDD — Behaviour-Driven Development is a collaborative practice where business, dev and QA describe behaviour in plain English (Gherkin) before code is written.
  2. Q2: What is SpecFlow — SpecFlow is the open-source BDD framework for .NET.
  3. Q3: Difference between SpecFlow and Cucumber — Cucumber is for Ruby/Java/JS; SpecFlow is the .NET port.
  4. Q4: Is SpecFlow being deprecated — The original SpecFlow project is in maintenance.
  5. Q5: What are the core Gherkin keywords — Feature , Background , Scenario , Scenario Outline , Examples , Given , When , Then , And , But .

Frequently asked questions

Yes for existing .NET teams, but new projects should evaluate Reqnroll — the community successor with the same API. SpecFlow skills transfer directly.

Yes. Gherkin describes behaviour, but step definitions and bindings are written in C#. Basic OOP and async/await are enough to start.

NUnit is the most common choice in BFSI and enterprise .NET shops. xUnit is preferred in newer SaaS codebases. MSTest is fine if your team standardises on it.

Yes. Inject a Playwright browser and an HttpClient/RestSharp client via DI and call them from different step definitions. Tag scenarios as @ui or @api for selective runs.

An experienced C# developer becomes productive in 1–2 weeks. The harder skill is writing behavioural Gherkin that survives refactors — that takes months of practice.

If your project is actively maintained, plan the migration in the next quarter. Reqnroll is API-compatible, ships faster updates and aligns with the future of .NET BDD.

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