Run Verification and Fix Issues
This skill guides you through running spec-test verification, interpreting results, and fixing common issues. Verification ensures all specifications have passing tests.
spec-test verify
This command:
design/specs/*.md for specifications@spec decorators in tests/The output shows each spec with a status:
Specification Verification Report
=================================
AUTH-001 PASS User can log in with valid credentials
AUTH-002 FAIL Invalid password returns error
AUTH-003 PENDING Account locks after failed attempts
AUTH-004 SKIP [manual] Password reset email timing
Coverage: 50% (2/4 automated specs passing)
| Status | Meaning | Action Required |
|---|---|---|
PASS |
Test exists and passes | None |
FAIL |
Test exists but fails | Fix test or implementation |
PENDING |
No test found for spec | Write a test |
SKIP |
Manual verification type | Human review needed |
Based on the status, take appropriate action:
Find the failing test:
spec-test check AUTH-002
Run the test with verbose output:
pytest tests/test_auth.py::test_invalid_password -v
Debug the failure:
Identify which spec needs a test:
spec-test list-specs
Write a test with the @spec decorator:
@spec("AUTH-003", "Account locks after failed attempts")
def test_account_lockout():
# Implementation
pass
Verify the spec is now tracked:
spec-test check AUTH-003
Symptom: spec-test check ID returns "Spec not found"
Causes:
design/specs/ directory**ID**:)Solution:
# Check file naming
ls design/specs/
# Verify spec format in file
grep -n "**AUTH-001**" design/specs/auth.md
Symptom: Spec shows PENDING but test exists
Causes:
@spec decoratortests/ directorytest_Solution:
# Ensure decorator is present and ID matches
@spec("AUTH-001", "Description") # ID must match exactly
def test_something(): # Must start with test_
pass
Symptom: Tests pass with pytest but spec-test shows PENDING
Solution:
# Specify correct directories
spec-test verify --specs docs/specs --tests tests
Exit code 1: Tests are failing
# Find and fix failing tests
spec-test verify
pytest tests/ -v --tb=short
Exit code 2: Missing tests (when --fail-on-missing is enabled)
# Either write missing tests or allow missing
spec-test verify --no-fail-on-missing
See detailed test output:
spec-test verify --verbose
Specify non-default locations:
spec-test verify --specs path/to/specs --tests path/to/tests
Save report to markdown file:
spec-test verify --output verification-report.md
Do not fail on PENDING specs:
spec-test verify --no-fail-on-missing
Check one spec at a time:
spec-test check AUTH-001
Output:
PASS AUTH-001: User can log in with valid credentials
Test: tests/test_auth.py::test_login_success
# Full verification
spec-test verify
# Verbose verification
spec-test verify -v
# Check single spec
spec-test check AUTH-001
# List all specs
spec-test list-specs
# Generate markdown report
spec-test verify -o report.md
# Custom directories
spec-test verify -s specs -t tests
# Allow missing tests
spec-test verify --no-fail-on-missing
Add to your CI pipeline:
# GitHub Actions example
- name: Verify Specifications
run: |
pip install spec-test
spec-test verify
# GitLab CI example
verify-specs:
script:
- pip install spec-test
- spec-test verify --output verification-report.md
artifacts:
paths:
- verification-report.md
Before committing:
spec-test verify exits with code 0