liveBook · Manning

Feature file

As explained in Shipping Go: Develop, deliver, discuss, design, and go again

A feature file is a text file that specifies software behavior as features and scenarios for a behavior-driven development test runner.

A feature file turns a user-facing requirement into an executable description of behavior. Written in Gherkin, it groups a feature with scenarios that describe expected outcomes, giving developers and project managers a shared target for integration tests. section 9.2

A practical feature-file workflow includes:

  • Run the feature through Godog against the whole application rather than individual packages; unfinished steps intentionally keep the build from passing. section 9.3 section 9.2
  • Reuse the same feature definition for backend, user-interface, or end-to-end tests when the behavior remains shared. section 9.2

Translation feature

Feature: Translation Service describes that users can submit a word for translation. Its Translation scenario says Given the word "hello", When I translate it to "german", Then the response should be "Hallo". Godog maps these steps to Go functions, starts the API in a test server, calls the endpoint, and checks the returned translation.

How Shipping Go: Develop, deliver, discuss, design, and go again covers it

How deep it goes
Explains Gherkin structure, step mapping, execution, and assertions, but stops short of defining the Gherkin language formally.
Examples
Uses a translation service scenario covering a word, target language, API call, and expected response.
What you can do after
Operate/configure Godog to turn a Gherkin scenario into an application-level test with executable step definitions.
How it connects
Connects behavior-driven development, Gherkin, Godog, integration testing, and end-to-end testing.

Also explained in

Compare how 3 books explain feature file →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Shipping Go: Develop, deliver, discuss, design, and go again. The section links point to the parts of the book it draws on.