Skip to content

Tests

Testudos uses pytest for Python tests, with a built-in pytest plugin that provides fixtures to connect to the engine and (optionally) start/stop your AUT.

Prerequisites

  • Testudos engine is running (headless, daemon, or GUI).
  • Your AUT profile is registered in the engine (the name you pass as testudos_aut_name must match the engine config).

Install requirements (pytest + Testudos)

In your venv:

Terminal window
python -m pip install -U pip pytest
python -m pip install testudos

If you’re working from this repository, you’ll typically install the Python package from python/ (editable install) or install a built wheel from build-deploy (see the Quickstart).

Configure engine host/port

The pytest plugin reads the engine location from environment variables:

  • TESTUDOS_ENGINE_HOST (default: localhost)
  • TESTUDOS_ENGINE_PORT (default: 4322)

Example:

Terminal window
export TESTUDOS_ENGINE_HOST=127.0.0.1
export TESTUDOS_ENGINE_PORT=4322
python -m pytest -v

Writing tests

Option A: Connect to an already-running AUT (use testudos_client)

Use testudos_client when your test only needs an engine connection (for example, unit-ish API tests, or flows where the AUT lifecycle is managed outside pytest).

Minimal example:

from testudos import wait_for_object
def test_can_find_primary_button(testudos_client):
btn = wait_for_object("primaryButton")
assert btn is not None

Option B: Let pytest start/stop the AUT per test (use testudos_app)

Use testudos_app when each test should run against a fresh AUT process. This fixture:

  • stops any running AUT (best-effort)
  • selects the AUT profile named by testudos_aut_name
  • starts the AUT before the test
  • stops the AUT after the test

You must define testudos_aut_name either in your test module or in a conftest.py that applies to your tests.

Example:

import pytest
from testudos import wait_for_object
@pytest.fixture(scope="module")
def testudos_aut_name():
return "ExampleTestApp"
def test_login_button_exists(testudos_app):
login_btn = wait_for_object("loginButton", timeout=10.0)
assert login_btn is not None

Running your tests

Run pytest against your test directory or file:

Terminal window
export TESTUDOS_ENGINE_HOST=127.0.0.1
export TESTUDOS_ENGINE_PORT=4322
python -m pytest <YOUR_TESTS_DIR_OR_FILE> -v

Notes:

  • Tests that use testudos_client / testudos_app require a reachable engine; if the engine is unreachable, those tests will be skipped by the plugin.