The Blackbox Automated Testing (BAT) CLI wrapper is a command line wrapper that you install to execute API tests.
Prerequisite for Linux and macOS Systems
Before installing BAT CLI, ensure that Java 17 is installed:
java -version
Prerequisites for Windows 10 Systems
-
Install Windows Subsystem for Linux (WSL)
The instructions are at https://learn.microsoft.com/en-us/windows/wsl/install.
-
Install Java 17, curl, and the application "unzip" into the Linux distribution that you installed in your WSL.
-
Ensure that the
JAVA_HOMEvariable in your environment is set to the location of your Java installation. -
Add the
batexecutable to yourPATHenvironment variable:-
Open the
~/.bashrcfile (if you are usingbash) or the~/.zshrcfile (if you are usingzsh) for editing. For example, to use thevieditor, enter either of these commands:vi ~/.bashrcvi ~/.zshrc -
Add the following line to the end of the file and then save the file:
export PATH=$PATH:~/.bat/bat/bin
-
Install BAT
You can install BAT CLI on Linux, macOS, and Windows.
Linux and macOS Systems
-
Download the BAT CLI ZIP file and save it in your
Downloadsdirectory. -
Open a terminal and run the following command to install BAT CLI:
BAT_ZIP="$(ls -t "$HOME"/Downloads/bat-wrapper*.zip 2>/dev/null | head -n 1)" if [ -z "$BAT_ZIP" ]; then echo "BAT CLI ZIP file was not found in the Downloads directory." else mkdir -p "$HOME/.bat" unzip -o "$BAT_ZIP" -d "$HOME/.bat" chmod +x "$HOME/.bat/bat/bin/bat" fiThe command selects the most recently downloaded BAT CLI ZIP file and installs it under
$HOME/.bat. -
Add BAT CLI to your
PATH.Identify your default shell:
basename "$SHELL"-
If the command displays
zsh, run:echo 'export PATH="$HOME/.bat/bat/bin:$PATH"' >> "$HOME/.zshrc" . "$HOME/.zshrc" -
If the command displays
bash, run:echo 'export PATH="$HOME/.bat/bat/bin:$PATH"' >> "$HOME/.bashrc" . "$HOME/.bashrc" -
If a different shell is displayed, add
$HOME/.bat/bat/binto the startup file used by that shell.
-
-
Run the following command to verify that BAT CLI is installed:
bat --versionThe installation is successful if the command displays the BAT CLI version.
Windows
-
Click here to automatically download the ZIP file of the BAT wrapper for Windows.
-
Unzip the ZIP file to install BAT CLI in your Windows environment.
-
Run the command
bat -versionto verify that BAT CLI is installed.