Skip to content

Latest commit

 

History

History
88 lines (63 loc) · 1.75 KB

File metadata and controls

88 lines (63 loc) · 1.75 KB

intent-spec

Language-agnostic Intent-Behavioral Testing framework.

Overview

intent-spec implements the Intent-Behavioral Testing (IBT) methodology for testing software through natural language intent specifications rather than traditional assertion-based tests.

Features

  • Language-agnostic: Define intents in YAML/JSON, test any language
  • Semantic assertions: LLM-powered evaluation of test outcomes
  • pytest integration: Native pytest plugin with @intent markers
  • Multiple interfaces: CLI, pytest plugin, HTTP API
  • Coverage tracking: Intent coverage reports

Installation

pip install intent-spec

With all optional features:

pip install intent-spec[all]

Quick Start

1. Create an intent specification

# intents.yaml
version: "1.0"
project: "my-api"
language: "python"

intents:
  - id: user-login
    description: "User can authenticate with email and password"
    category: auth
    priority: critical
    behaviors:
      - precondition: "User exists in database"
        action: "Login with valid credentials"
        postcondition: "Returns JWT token"

2. Validate the specification

intent-spec validate intents.yaml

3. Generate test stubs

intent-spec generate intents.yaml --output tests/

4. Run with pytest

@pytest.mark.intent("user-login")
def test_login_success():
    result = api.login("[email protected]", "password")
    assert result.token is not None

CLI Commands

# Validate spec file
intent-spec validate intents.yaml

# Show parsed spec
intent-spec show intents.yaml

# Generate test stubs
intent-spec generate intents.yaml --output tests/

# Coverage summary
intent-spec coverage intents.yaml

License

MIT