Quickstart
Get up and running with Magnitude
Setup
Install our test library
or see our demo repo if you don’t have a project to try it on
Initialize Magnitude
This will create a basic tests directory tests/magnitude
with:
magnitude.config.ts
: Magnitude test configuration fileexample.mag.ts
: An example test file
Configure LLM
The easiest way to set up an LLM for Magnitude is to set the ANTHROPIC_API_KEY
environment variable. Sonnet 4 will be used by default. See LLM Configuration for more details.
🚀 Now you’re ready to run tests!
Running tests
Run your Magnitude tests with:
This will run all Magnitude test files discovered with the *.mag.ts
pattern. If the agent finds a problem with your app, it will tell you what happened and describe the bug!
To run many tests in parallel, add
-w <workers>
To learn more about different options for running tests see here.
Building test cases
Now that you’ve got Magnitude set up, you can create real test cases for your app. Here’s an example for a general idea:
Acts, checks, and data are all natural language. Think of it like you’re describing how to test a particular flow to a co-worker - what steps they need to take, what they should check for, and what test data to use.
For more information on how to build test cases see our docs.