Skip to main content

Forge QA test cases from text, documents, Confluence pages, and Figma designs using LLMs

Project description

testsmith

License: MIT Python 3.11+ Code style: ruff

Forge QA test cases from text, documents, Confluence pages, and Figma designs using LLMs.

testsmith is a CLI that takes a feature description and/or supporting sources (local files or URLs), sends them to an LLM (Anthropic Claude or Google Gemini), and writes the generated test cases to a CSV file.

Requirements

  • Python >= 3.11
  • An API key for one of the supported providers:
    • ANTHROPIC_API_KEY for Anthropic Claude
    • GOOGLE_API_KEY (or GEMINI_API_KEY) for Google Gemini

Configuration

testsmith reads configuration from environment variables and/or a .env file in the current directory. Environment variables always take priority.

cp .env.example .env   # then edit .env with your values

See .env.example for all available settings.

Installation

Via pipx (recommended)

pipx installs CLI tools in isolated environments so they don't conflict with your system Python:

# Install pipx (pick your platform)
# macOS:   brew install pipx
# Linux:   python3 -m pip install --user pipx
# Windows: python -m pip install --user pipx

pipx install testsmith-ai

To upgrade later:

pipx upgrade testsmith-ai

Via pip (in a virtualenv)

# macOS / Linux
python3 -m venv .venv && source .venv/bin/activate

# Windows
python -m venv .venv && .venv\Scripts\activate

pip install testsmith-ai

From source (for development)

git clone https://github.com/priyankshah217/testsmith.git
cd testsmith

# macOS / Linux
python3 -m venv .venv && source .venv/bin/activate

# Windows
python -m venv .venv && .venv\Scripts\activate

pip install -e ".[dev]"

This installs the testsmith command on your PATH.

Usage

testsmith [OPTIONS]

You must provide at least one of --prompt, --file, or piped stdin.

Options

Option Description
-p, --prompt TEXT Plain text prompt / feature description.
-f, --file REF Input source: local file (PDF, DOCX, MD, TXT) or URL (e.g. Confluence page). Repeatable.
-o, --out PATH Output CSV path. If omitted, the LLM suggests a kebab-case filename based on the feature (e.g. login-social-auth.csv). Collisions get _2, _3, ...
--provider TEXT LLM provider: anthropic or gemini. Auto-detected from env if omitted.
-m, --model TEXT LLM model name (e.g. claude-sonnet-4-6, gemini-2.5-flash). Defaults per provider.
-t, --temperature FLOAT Sampling temperature (0.0–2.0). Lower = more deterministic.
--top-p FLOAT Nucleus sampling top-p (0.0–1.0).
--format TEXT Test step format: steps (default, numbered) or bdd (Given/When/Then, business-focused).
--trace Add source traceability columns (document, section, quote, derivation) to CSV output.
--max-tokens INT Maximum output tokens for LLM response (default 16384). Increase for large prompts or thinking models.
--debug Dump raw LLM response to debug_response.txt for troubleshooting parse failures.
-s, --system TEXT Custom system prompt. Inline text or @path/to/file.txt. Replaces the default.
--append-system Append --system to the default system prompt instead of replacing it.
-u, --user-template TEXT Custom user prompt template. Inline text or @path/to/file.txt. Use {context} as a placeholder.
-i, --interactive Let the LLM ask clarifying questions adaptively before generating. It asks one question at a time and stops as soon as it has enough context (0–5 questions). Type skip to skip a question or done to stop early.

Supported input sources

Source Example
Plain text -p "Login screen with social auth"
PDF -f ./specs/checkout.pdf
DOCX -f ./specs/payment.docx
Markdown / text -f ./notes.md
Confluence page -f https://acme.atlassian.net/wiki/spaces/ENG/pages/12345/Checkout-PRD
Figma design (text-only) -f "https://www.figma.com/design/<fileKey>/<name>?node-id=1-23"

Adding new sources (Notion, Jira, Linear, ...) is a single file in testsmith/sources/ — see testsmith/sources/base.py for the Source protocol.

Confluence setup

Set these in your .env file or as environment variables:

CONFLUENCE_BASE_URL=https://your-site.atlassian.net
CONFLUENCE_EMAIL=you@example.com
CONFLUENCE_API_TOKEN=<token from id.atlassian.com/manage-profile/security/api-tokens>

Figma setup

Set in your .env file or as an environment variable:

FIGMA_API_TOKEN=<token from figma.com/settings>

Figma support is text-only in v1: frame/component names become headings, text layers become body text, and component descriptions are preserved. Purely visual nodes (vectors, rectangles, etc.) are skipped. If the URL contains a node-id, only that subtree is fetched; otherwise the whole file is loaded. Tip: right-click a frame in Figma → Copy link to get a URL with the right node-id.

Examples

Generate from an inline prompt (LLM picks the filename):

testsmith -p "Login screen with email + password, forgot password link, and social login"

Generate from documents:

testsmith -f specs/checkout.pdf -f specs/payment.docx

Generate from a Confluence page:

testsmith -f https://acme.atlassian.net/wiki/spaces/ENG/pages/12345/Checkout-PRD

Generate from a Figma design (quote the URL — the ? will be interpreted by your shell otherwise):

testsmith -f "https://www.figma.com/design/ABC123/Checkout?node-id=42-1337"

Mix a prompt with supporting files, Confluence pages, and Figma designs:

testsmith -p "Focus on edge cases" \
  -f "https://www.figma.com/design/ABC123/Checkout?node-id=42-1337" \
  -f https://acme.atlassian.net/wiki/spaces/ENG/pages/12345/PRD \
  -f specs/wireframes.pdf

Pipe text via stdin:

cat feature.md | testsmith

Pick a provider explicitly:

testsmith -p "Signup flow" --provider anthropic

Interactive mode (LLM asks clarifying questions only when genuinely ambiguous):

testsmith -i -p "Checkout flow with guest and returning users"

Generate BDD-style test cases (Given/When/Then, business-focused):

testsmith -p "Subscription renewal flow" --format bdd

Use a specific model with custom temperature:

testsmith -p "Signup flow" -m claude-sonnet-4-6 -t 0.3

Use a custom system prompt from a file:

testsmith -f spec.pdf --system @prompts/qa_system.txt

Append to the default system prompt instead of replacing it:

testsmith -f spec.pdf --system "Focus on accessibility test cases." --append-system

Force an explicit output filename:

testsmith -p "Password reset flow" -o reset.csv

Output

Test cases are written to a CSV with columns: ID, Title, Preconditions, Steps, Expected Result, Priority, Type

When --trace is enabled, additional source traceability columns are appended: source.document, source.section, source.quote, source.derivation

By default the filename is suggested by the LLM based on the feature context; pass -o to override.

Step formats

--format Steps column example
steps (default) 1. Open app (each step on its own line)
bdd Given user has an active account / When user provides valid credentials / Then user is authenticated (each keyword on its own line)

BDD mode enforces business-focused language — steps describe domain intent and outcomes, not UI interactions (no "click", "tap", "navigate", etc.).

Claude Code skill

Testsmith ships with a Claude Code skill so Claude can run testsmith for you when you ask for test cases.

Install the skill

Copy the bundled skill to your Claude Code skills directory:

# macOS / Linux
cp -r skills/testsmith ~/.claude/skills/

# Windows (PowerShell)
Copy-Item -Recurse skills\testsmith $env:USERPROFILE\.claude\skills\

Or create a symlink so it stays in sync with the repo:

ln -s "$(pwd)/skills/testsmith" ~/.claude/skills/testsmith

Once installed, just ask Claude Code: "generate test cases for the login screen" — it will invoke testsmith automatically.

Contributing

git clone https://github.com/priyankshah217/testsmith.git
cd testsmith
python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest tests/ -v

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

testsmith_ai-0.3.1.tar.gz (36.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

testsmith_ai-0.3.1-py3-none-any.whl (29.6 kB view details)

Uploaded Python 3

File details

Details for the file testsmith_ai-0.3.1.tar.gz.

File metadata

  • Download URL: testsmith_ai-0.3.1.tar.gz
  • Upload date:
  • Size: 36.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for testsmith_ai-0.3.1.tar.gz
Algorithm Hash digest
SHA256 50fe04eefd795ff542bcdf9bde1bb76c834663bd8acd315e83bca373de11527e
MD5 ccf7cdd9d2954d36f48116980abb8cc5
BLAKE2b-256 0d3be5845f39cdd90857e1408032034a8df07168370b0603feaed0b993d8d031

See more details on using hashes here.

Provenance

The following attestation bundles were made for testsmith_ai-0.3.1.tar.gz:

Publisher: publish.yml on priyankshah217/testsmith

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file testsmith_ai-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: testsmith_ai-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 29.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for testsmith_ai-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b4ae90081128f55139a2326b57cb6a67b0f40c49bf5f6783c1d80a959729faad
MD5 b5a381253f2148573fea31a9261d593d
BLAKE2b-256 c6ff0ccedf6036cab8f4275b3f1db50494271215cdf58be622a06a20b8cb3194

See more details on using hashes here.

Provenance

The following attestation bundles were made for testsmith_ai-0.3.1-py3-none-any.whl:

Publisher: publish.yml on priyankshah217/testsmith

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page