Stop writing API test scripts. Use plain English instead.

Published: (February 24, 2026 at 11:13 AM EST)
3 min read
Source: Dev.to

Source: Dev.to

Overview

Octrafic lets you write API tests in plain English. Describe what you want tested, and the AI generates the appropriate HTTP requests based on your OpenAPI/Swagger spec, executes them, and reports pass/fail results.

Installation

Linux/macOS

curl -fsSL https://octrafic.com/install.sh | bash

Homebrew

brew install octrafic/tap/octrafic

Windows (PowerShell)

iex (iwr -useb https://octrafic.com/install.ps1)

Setup

Octrafic supports Claude, OpenAI, OpenRouter, Gemini, Ollama, and llama.cpp. You provide your own API key; nothing is sent through the developer’s servers.

Run Octrafic for the first time and follow the interactive setup wizard.

Local LLM (no external API key)

ollama pull qwen2.5:7b

During setup, point Octrafic to the local model.

Using the TUI

octrafic -u https://api.example.com -s openapi.json -n "My API"
  • -u – API base URL
  • -s – Path to your OpenAPI/Swagger spec
  • -n – Project name

Once inside the TUI, describe the tests in plain English, e.g.:

  • test the login endpoint with valid credentials
  • test the login endpoint with a wrong password
  • test creating a new user and check the response structure
  • run edge cases on the /users endpoint

The AI determines the correct HTTP method, URL, headers, and payload, executes the request, and shows the response with a pass/fail result.

Authentication

Pass authentication details via CLI flags when starting a session.

Bearer token

octrafic -u https://api.example.com -s spec.json \
  --auth bearer --token "your-token-here"

API key

octrafic -u https://api.example.com -s spec.json \
  --auth apikey --key X-API-Key --value "your-key-here"

Basic auth

octrafic -u https://api.example.com -s spec.json \
  --auth basic --user admin --pass secret123

Or use environment variables to avoid storing credentials in shell history:

export OCTRAFIC_AUTH_TYPE=bearer
export OCTRAFIC_AUTH_TOKEN=your-token-here
octrafic -u https://api.example.com -s spec.json

Note: Your actual tokens and passwords never leave your machine; the AI only receives the auth type and header names.

Exporting Tests

After an interactive session, you can ask the AI to export the generated tests:

  • export these tests to postman
  • export tests as a shell script
  • export to pytest and name it test_users_api.py

Exports are saved to ~/Documents/octrafic/tests/.

You can also export a test plan before execution if you prefer to run the tests later.

CI / Pipelines

For non‑interactive use, employ the octrafic test subcommand:

octrafic test \
  --url https://api.example.com \
  --path tests/api-tests.json \
  --auth bearer \
  --token $API_TOKEN

Or generate and run tests directly from a prompt:

octrafic test \
  --url https://api.example.com \
  --spec openapi.json \
  --prompt "test all user endpoints"

The command exits with 0 if all tests pass, 1 otherwise.

GitHub Actions Example

- name: Run API tests
  run: |
    octrafic test \
      --url ${{ secrets.API_URL }} \
      --path tests/api-tests.json \
      --auth bearer \
      --token ${{ secrets.API_TOKEN }}

Persistence

New sessions are temporary by default. Use the /save command inside the TUI to persist your project, or watch for the temporary indicator in the status bar.

Contributing & Resources

Octrafic is open‑source and early in development. If you encounter issues or have ideas, please open an issue.

0 views
Back to Blog

Related posts

Read more »

DevOps and Vibe Coding: A Journey

Things to Do Map Your Application - Map your application on paper, in a spreadsheet, or using graphics/flowcharts. This is the first step. - Understanding the...

OpenAI just raised $110 billion. Wow

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as we...