Skip to content

Behavior-Driven Development with ZapCircle

Behavior-Driven Development (BDD) is a development methodology from the early 2000’s that bridges the gap between developers and product owners by focusing on defining and implementing software behaviors. Originally, this was applied to testing with tools such as Cucumber.

Now that we have Large Language Models (LLMs), behavior-driven development becomes a lot more powerful, and can be used for code generation.


In ZapCircle, behaviors are the foundation for both development and testing. These behaviors are described in .zap.toml files, which act as structured, human-readable specifications for what a software component should do. This approach ensures that:

  • Product owners have a clear understanding of what will be built.
  • Developers have a precise blueprint for implementation.
  • Behaviors are checked into source control, and versioned along with the source code. The source of truth is in the code base, and not in the issue tracking system.

BDD prioritizes communication between product owners, developers, testers, and other stakeholders. ZapCircle reinforces this by:

  • Providing a behavior-driven framework that eliminates ambiguities.
  • Ensuring that everyone speaks a common language through clear, behavior-focused specifications.

3. Automation with Behavior Specifications

Section titled “3. Automation with Behavior Specifications”

ZapCircle leverages behavior definitions to automate key steps in the development process:

  • Generate component code based on behaviors.
  • Generate comprehensive tests to validate component functionality.
  • Analyze the existing code base to generate behaviors.

Every .zap.toml file serves as a dynamic, up-to-date document that reflects the current state of the system. As components evolve, so do their behavior specifications, ensuring documentation remains relevant.

  • ZapCircle provides round-trip services to maintain source code and behavior files in sync, and future versions of ZapCircle will help detect drift.

  1. Define Behaviors

    • Collaborate with stakeholders to define the desired behaviors for a component.
    • Example: “When the user clicks the ‘Submit’ button, the form should validate inputs and display success or error messages.”
  2. Translate into Behavior Specifications

    • Use .zap.toml files to formalize these behaviors into actionable specifications.
    • Example Specification:
      name = "SubmitButton"
      behavior = """
      - Validate form inputs on click.
      - Display a success message on valid submission.
      - Show an error message for invalid inputs.
      """
  3. Generate Components and Tests

    • Run ZapCircle to automatically generate the SubmitButton component and its associated tests.
  4. Refine and Implement

    • Review the generated code and make project-specific adjustments.
    • Implement additional functionality if needed.
  5. Validate and Commit

    • Run the auto-generated tests to ensure the component meets the behavior specification.
    • Commit the .zap.toml file, component code, and tests to source control.

Automating code and test generation accelerates the development process, allowing developers to focus on refining features rather than building from scratch.

Behavior-first testing ensures components are built to meet clear requirements, reducing bugs and enhancing reliability.

Instead of wondering what prompt was used to generate code or make a change, the behavior is sitting in the source control system next to the code.

With .zap.toml files as living documents, teams always have up-to-date references for system behaviors.


  • When the user submits valid login credentials, they should be redirected to the dashboard.
  • If the credentials are invalid, an error message should be displayed.
name = "LoginForm"
behavior = """
- Validate email and password inputs.
- Redirect to dashboard on successful login.
- Display error messages for invalid credentials.
"""