Skip to content

wuttinanhi/aitestgen

Repository files navigation

aitestgen

Generate testcases from natural language descriptions

A command-line tool that leverages AI to automatically generate test cases from natural language prompts. This tool helps developers quickly create comprehensive test suites by describing what they want to test in plain English.

Requirements

Installation

yarn add -g aitestgen

Usage

Basic Command

aitestgen [options] [prompt]

Options

Usage: index [options]

Generate test from prompting

Options:
  -o, --out <path>           Output path for generated test file (default: "app.test.ts")
  -gd, --gendir <path>       Directory to save generated cache (default: ".gen/")
  -p, --provider <provider>  Set model provider "openai" "ollama" (default: "openai")
  -m, --model <model>        Specify model to use (default: "gpt-4o-mini")
  -oh, --ollamahost <url>    Set Ollama endpoint (default: "http://localhost:11434")
  -hl, --headless <bool>     Set browser headless mode (default: true)
  -t, --test                 Run test only (default: false)
  -v, --verbose              Verbose log (default: false)
  -h, --help                 display help for command

Examples

Generate new tests:

aitestgen -- go to http://localhost:3000 and fill the form then expect successful message

Run generated tests using Vitest:

aitestgen --test

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Development Setup

  1. Clone the repository
git clone https://github.com/wuttinanhi/aitestgen
  1. Install dependencies
yarn install
  1. Run tests
yarn test
  1. Link this package
yarn link

Yarn scripts

Option Description
start Start the program.
test Test the specs
gentest Test the generated code
lint Lint codebase
translate Translate test steps only

License

MIT

Author

wuttinanhi

Support

If you encounter any issues or have questions, please file an issue on the GitHub repository.