Files
arnes/spec/bdd

BDD — Behavior Driven Development

Índice


Overview

Este directorio contiene las especificaciones BDD fuente en formato Gherkin.

Separación recomendada:

  • spec/bdd/features/ = source-of-truth de escenarios
  • features/ = assets ejecutables del runner (steps, config)

naming conventions

spec/bdd/features/
├── <domain>/
│   ├── <feature-name>.feature
│   └── <feature-name>.feature
└── common/
    └── <common-feature>.feature

tags permitidos

Tag Uso
@F-XXX Link a feature del backlog
@smoke Tests críticos (siempre ejecutar)
@regression Tests de regresión
@integration Tests de integración
@e2e End-to-end tests
@unit Tests unitarios
@api Tests de API
@ui Tests de interfaz

Features

Ver spec/bdd/features/ para los archivos .feature.


Step Definitions

Los step definitions deben estar en:

  • Python: features/steps/*.py
  • JS/TS: features/step_definitions/*.ts
  • Go: features/steps/*.go

Template (Python/Behave)

"""Steps para login feature."""
from behave import given, when, then

@given('un usuario registrado con email "{email}" y password "{password}"')
def step_registered_user(context, email, password):
    """Crea usuario de prueba."""
    pass

@when('el usuario ingresa su email "{email}"')
def step_enter_email(context, email):
    """Ingresa email en el formulario."""
    pass

@when('ingresa password "{password}"')
def step_enter_password(context, password):
    """Ingresa password."""
    pass

@then('el sistema muestra mensaje de error "{message}"')
def step_show_error(context, message):
    """Verifica mensaje de error."""
    pass

Ejecutar Tests

Python (Behave)

behave features/
behave features/ --tags @smoke
behave features/ --tags ~@slow  # exclude

Node.js (Cucumber)

npx cucumber-js features/
npx cucumber-js features/ --tags "@smoke and @F-001"

Checklist de Feature

  • Feature documentado en Gherkin
  • Todos los scenarios tienen Given/When/Then
  • Tags @F-XXX presentes
  • Step definitions implementados
  • Tests ejecutables