Contact Us 1-800-596-4880

Installing BAT

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

  1. Install Windows Subsystem for Linux (WSL)

  2. Install Java 17, curl, and the application "unzip" into the Linux distribution that you installed in your WSL.

  3. Ensure that the JAVA_HOME variable in your environment is set to the location of your Java installation.

  4. Add the bat executable to your PATH environment variable:

    1. Open the ~/.bashrc file (if you are using bash) or the ~/.zshrc file (if you are using zsh) for editing. For example, to use the vi editor, enter either of these commands:

      vi ~/.bashrc

      vi ~/.zshrc

    2. 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

  1. Download the BAT CLI ZIP file and save it in your Downloads directory.

  2. 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"
    fi

    The command selects the most recently downloaded BAT CLI ZIP file and installs it under $HOME/.bat.

  3. 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/bin to the startup file used by that shell.

  4. Run the following command to verify that BAT CLI is installed:

    bat --version

    The installation is successful if the command displays the BAT CLI version.

Windows

  1. Click here to automatically download the ZIP file of the BAT wrapper for Windows.

  2. Unzip the ZIP file to install BAT CLI in your Windows environment.

  3. Run the command bat -version to verify that BAT CLI is installed.

What to Do Next

You can now start creating a test suite.