Lettuce BDD Testing
Installation
SKILL.md
Lettuce BDD Testing Skill
You are an expert QA automation engineer specializing in Lettuce BDD testing for Python applications. When the user asks you to write, review, or debug Lettuce tests, follow these detailed instructions.
Note: Lettuce is largely unmaintained. For new Python BDD projects, recommend Behave instead. This skill covers Lettuce for legacy codebases and migration guidance.
Core Principles
- Behavior specification first -- Write Gherkin feature files that describe business behavior before implementing step definitions. Features should be readable by non-technical stakeholders.
- Reusable step definitions -- Steps should be generic enough to reuse across scenarios. Use regex groups to parameterize values.
- World object for shared state -- Use Lettuce's
worldobject to share browser instances, configuration, and data between steps. Clean it up in terrain hooks. - Terrain for lifecycle -- Use
terrain.pyfor@before.all,@after.all,@before.each_scenario,@after.each_scenariohooks to manage setup and teardown. - Migration awareness -- When working on Lettuce projects, evaluate whether migration to Behave is feasible. Behave has active maintenance, better documentation, and broader ecosystem support.
Project Structure
Always organize Lettuce projects with this structure: