Test Generation featuring HaloAI
PactFlow's Test Generation features are currently available through an open beta program. During this stage, all customers can explore the capabilities within fixed usage limits (more info).
If you donβt already have a PactFlow account, get started with our free Starter plan.
PactFlow's Test Generation feature, is an AI-powered capability designed to help users quickly generate Pact tests. By providing access to source code, OpenAPI descriptions, or traffic capture data, it reduces the time and effort needed to create and maintain contract tests.
Enabling the featureβ
This feature is disabled by default on all organisations. To enable the feature:
- In the UI, navigate to "Settings" -> "Preferences" -> "System Preferences".
- Check the "Test Generation" checkbox.
- Save the settings.
This setting is only available in the new user interface.
Installationβ
For *nix users (including Windows users running WSL/msys2/mingw), use the following command to download and install:
curl https://download.pactflow.io/ai/get.sh | sh
For Windows PowerShell users, use the following command to download and install:
Invoke-WebRequest -Uri https://download.pactflow.io/ai/get.ps1 | Invoke-Expression
Installation Optionsβ
There are some options which you can set during installation.
For a full list, see the --help
/-h
command
curl https://download.pactflow.io/ai/get.sh | sh -s -- -h
--verbose
/-v
/PACTFLOW_AI_VERBOSE
: Enable verbose output--quiet
/-q
/PACTFLOW_AI_QUIET
: Disable progress output--yes
/-y
/PACTFLOW_AI_YES
: Disable confirmation prompt and assume 'yes'--destination
/-d
/PACTFLOW_AI_DESTINATION
: Specify the directory to install the binary--default-host
/PACTFLOW_AI_DEFAULT_HOST
: Choose a default host triple rather than autodetecting--no-modify-path
/PACTFLOW_AI_NO_MODIFY_PATH
: Don't configure the PATH environment variable
Verify the installation by running pactflow-ai
to ensure it executes successfully.
Manual installationβ
Alternatively, download the latest version for your OS and architecture from the table below. Be sure to add it to your environment's PATH
:
OS | Architecture | Link |
---|---|---|
Apple Darwin | aarch64 | |
Apple Darwin | x86_64 | |
Windows MSVC | x86_64 | |
Windows MSVC | aarch64 | |
Linux GNU | x86_64 | |
Linux MUSL | x86_64 | |
Linux GNU | aarch64 | |
Linux MUSL | aarch64 |
Linux GNU users will require glibc version 2.23 or later.
Environments which do not use glibc, or use a version of glibc prior to 2.23, should instead use the musl variant.
Usageβ
Running pactflow-ai --help
will show detailed usage for any subcommands.
Authenticationβ
Authentication requires valid PactFlow API Tokens, which can be obtained from the Settings > Tokens
page of your PactFlow organisation.
You can authenticate with the CLI in several ways:
Environment Variablesβ
Set the following environment variables, and the CLI will use them to communicate with PactFlow:
export PACT_BROKER_BASE_URL="https://YOUR_ORG.pactflow.io"
export PACT_BROKER_TOKEN="YOUR_TOKEN"
Local configuration fileβ
Configure the CLI using the following commands:
pactflow-ai config set broker.base-url https://YOUR_ORG.pactflow.io
pactflow-ai config set broker.auth.token YOUR_TOKEN
This creates a .pact.toml
file, which should be added to your .gitignore
.
User configuration fileβ
Alternatively, store the user configuration file in ~/.config/pact/config.toml
(Unix and macOS), and %APPDATA%\pact\config.toml
(Windows).
Pass the --user
flag when running pactflow-ai config set
to write to this file automatically.
Usage Limitsβ
Access to the feature is metered based on the number of tests generated in a 30-day rolling window. Credits are allocated as follows:
- Starter Plans: 10 credits per month
- All other plans: 10 credits per purchased user per month
Credits are allocated to the organisation, not individual users.
Examplesβ
Starter Plan
If you have a free plan, you are entitled to 10 tests per month no matter how many active users there are.
Team Plan
If you are on a Team 10 Plan (5 active users), you receive for 10 credits x 10 users for a total of 100 credits.
Enterprise Plan
If you are on an Enterprise Plan with 50 users (42 active users), you receive for 10 credits x 50 users for a total of 500 credits.
Consumptionβ
Each successfully generated test consumes a credit. If your organisation reaches its limit, you will see the following error:
ERROR: Client error: 403 Forbidden AI credits are exhausted.
The limits and your usage against these limits are not currently visible on the subscription page. This will be added in due course.
Getting help and providing feedbackβ
For feedback, feature requests, or assistance with the tool, join our slack channel or speak directly with your Account Manager. For general support, please follow the usual methods.
Tutorialsβ
We've created an in-browser tutorial to help you get started with PactFlow's test generation feature.