Skip to content

Language-agnostic Intent-Behavioral Testing framework - Define test intents in natural language, run them against any language

Notifications You must be signed in to change notification settings

contextfs/intent-spec

Repository files navigation

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("user@example.com", "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

About

Language-agnostic Intent-Behavioral Testing framework - Define test intents in natural language, run them against any language

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages