Skip to content

Install TestGen with pip

As an alternative to the Docker Compose installation, you can install TestGen as a Python package via pip. This mode requires you to provision your own PostgreSQL instance for the application database and manage Python dependencies directly.

Tip

For most users, the Docker-based installation (Mac/Linux or Windows) is recommended. Docker encapsulates all dependencies and does not require a separate PostgreSQL setup.

Prerequisites

Install the following prerequisites, and verify that their versions are supported.

Software Supported versions Command to check version
Python 3

Most Linux and macOS systems have Python pre-installed. On Windows, you will need to download and install.
3.12 python3 --version
PostgreSQL

A running PostgreSQL instance for the TestGen application database. The connection user must have privileges to create roles, databases, and schemas.
14, 15, 16 psql --version

How to install TestGen

  1. Create and activate a Python virtual environment with Python 3.12 or later.

    On Linux/Mac:

    python3 -m venv venv
    source venv/bin/activate
    

    On Windows:

    py -3.12 -m venv venv
    venv\Scripts\activate
    
  2. Install the TestGen package.

    pip install dataops-testgen
    
  3. Verify that the testgen CLI is available.

    testgen --help
    

How to configure the application database

  1. Create a file named local.env with the following environment variables. Replace the <value> placeholders with values for your environment.

    # PostgreSQL connection
    export TG_METADATA_DB_HOST=<postgres_hostname>
    export TG_METADATA_DB_PORT=<postgres_port>
    export TG_METADATA_DB_USER=<postgres_username>
    export TG_METADATA_DB_PASSWORD=<postgres_password>
    
    # Encryption key for secrets stored in the application database
    export TG_DECRYPT_PASSWORD=<encryption_password>
    export TG_DECRYPT_SALT=<encryption_salt>
    
    # Default admin user credentials
    export TESTGEN_USERNAME=<username>
    export TESTGEN_PASSWORD=<password>
    
    # Signing key for authentication tokens (base64-encoded)
    export TG_JWT_HASHING_KEY=<base64_key>
    
    # Log file path
    export TESTGEN_LOG_FILE_PATH=<path_for_logs>
    

    For the full list of supported configuration options, see Configuration.

  2. Source the file to apply the environment variables.

    source local.env
    

    On Windows, set each variable using set or $env: — see this guide for details.

  3. Initialize the application database.

    testgen setup-system-db --yes
    

How to run TestGen

Start the application. The UI opens at http://localhost:8501.

testgen run-app

Log in with the TESTGEN_USERNAME and TESTGEN_PASSWORD values you configured above.

How to set up demo data

To explore TestGen with sample data, run the quick-start command:

testgen quick-start

Tip

To upgrade an instance of TestGen to the latest released version, see Upgrade TestGen. For other post-install tasks, see Administer TestGen.