Tests

uatools has three test surfaces, each catching a different class of regression:

  • C++ unit + integration tests (gtest) — contract checks for eso::uatools::Client (capabilities, lifecycle, Result shapes) plus integration tests that spawn the YAML-driven test server in-thread and drive ualib end-to-end (Read, Write, Call, connection sharing, per-node handler isolation, Subscribe + write notification round-trip, handler-can-call-Read-without-deadlock).

  • Robot Framework integration tests — exercise the C++ UaClient and UaItestServer binaries plus the four Python tools end-to-end. Each suite spins up its own test server on a free port so suites can run in parallel without port collisions.

  • CMake-build smoke tests — drive a clean cmake configure/build/install cycle into /tmp/ and assert that every expected artefact lands in the install tree. Surface any drift between the waf and CMake build systems before VLTSW consumers do.

C++ tests (gtest, via waf)

Build + run the gtest binary:

cd uatools
waf install
waf test --alltests

The binary covers two distinct test programs side by side:

  • ClientCapabilities / ClientContract / ClientLifecycle / ClientDataOps — unit-level contract checks. No network, run in well under a second, no external dependencies.

  • IntegrationTest — integration suite that spins up the YAML server library (uatoolsItestSrv) in a background thread on a free port and drives eso::uatools::Client against it. Covers Read / Write / Call, connection sharing across two Clients, per-node SubscriptionHandler isolation, Subscribe + Write notification round-trip, and the threading review’s “handler-can-call-Read-without-deadlock” regression.

A test-time env var lets you crank up SDK logging when debugging:

UATOOLS_ITEST_LOG_LEVEL=INFO waf test --alltests

Default is ERROR (silent unless a real problem occurs).

The CMake build path does not build the test binary — the gtest suite is driven through waf. CMake’s role is to install the shippable library + binary set; tests stay in the primary build system.

Robot tests

Suites live under test/uatools/src/ (and one peer suite in ifw-fnd/test/fnd/):

  • uaclient.robot — UaClient C++ CLI end-to-end against UaTstServer. Spawns the server on a free port, runs every subcommand (status, read, write — both explicit and auto-detect, browse, browse -r/–values, call, subscribe, watch-state), and the URI shorthand forms (host:port and bare port). Verifies return codes and stdout. Includes Phase-1-logging verification (-l debug / -l trace).

  • uaitestserver.robot — UaItestServer C++ binary, YAML-driven. Spawns the binary with a tiny fixture YAML (test/uatools/resource/uaitestserver.cfg.yaml) and drives it with UaClient. Verifies that the YAML’s folder + variables + method appear in the address space and that read/write/call work end-to-end. Companion to the gtest IntegrationTest suite — the gtests cover the library form; this suite covers the CLI binary.

  • uashell.robot — UaShell CLI + programmatic invocation, the URL-format shorthands (full URI / host:port / bare port), the xargs pipe target, and the large-namespace features (lazy loading limit / PARTIAL browse / scan / Views with scoped browse pruning / and the persistent SQLite namespace cache with load-from-disk and set nscache toggle).

  • uaexplorer.robot — UaExplorer browser + inspector behaviour, including the persistent SQLite namespace cache (persist + load round-trip).

  • uaexplorer_scripting.robot — UaExplorer’s Python scripting pipeline.

  • uaplot.robot — UaPlot client library integration tests (create/list plots, plot variables, add/remove series, session load).

  • uasubscription.robot — UaSubscription integration tests: push mode (UaShell-style --socket feeding update/remove/clear) and standalone mode (own worker, session auto-load, live values + stats). Table state is read back over IPC via the get_subscriptions query.

  • cmake_build.robot — CMake-build smoke test for uatools. See “CMake-build smoke tests” below.

Run via ETR:

cd uatools/test/uatools
etr

ETR auto-discovers the suites listed in etr.yaml and writes HTML reports under logs/.

Or run a single suite directly:

cd uatools/test/uatools
etr --step setup
robot src/uaclient.robot

The GUI suites (UaExplorer, UaPlot) need an X display. Use the bundled Xvfb wrapper when running headless (CI, SSH without X forwarding):

./src/run-all-robot.sh

The wrapper runs each suite under xvfb-run sequentially so Qt / asyncio state stays isolated between suites.

CMake-build smoke tests

Two robot suites guard the CMake build paths:

  • uatools/test/uatools/src/cmake_build.robot — drives a clean cmake configure/build/install cycle on the uatools repo into /tmp/cmake-build-test-<id>/ and asserts that both shared libs (libuatoolsUalib.so, libuatoolsItestSrv.so), the UaItestServer binary, and the public headers land in the install tree.

  • ifw-fnd/test/fnd/src/cmake_build.robot — same shape for ifw-fnd: builds + installs into a temporary prefix and checks that libifwFndDefs.so, libifwFndTools.so, and every ifw/fnd/{defs,tools}/ header appear under include/.

These suites catch the “someone added a .cpp/.hpp to wscript but forgot to update CMakeLists” class of bug before it bites a downstream VLTSW build. The temp prefix means $INTROOT is never touched.

Run from the respective test directory:

cd uatools/test/uatools
etr --step setup
robot src/cmake_build.robot

cd ifw-fnd/test/fnd
etr --step setup
robot src/cmake_build.robot

Test resources

  • UaShell ``.uas`` scripts driving the CLI tests: test/uatools/src/uashell_scripts/*.uas.

  • Python scripts driving UaExplorer scripting tests: test/uatools/src/uaexplorer_scripts/*.py.

  • Robot keyword libraries (Python): test/uatools/src/support/ — one per suite, plus the shared cmake_build_keywords.py and uaitestserver_keywords.py.

  • YAML fixtures: test/uatools/resource/ — currently holds uaitestserver.cfg.yaml (folder + variables + method).

  • UaTstServer is spawned by the keyword libraries on a free port per suite, so suites can run in parallel without port conflicts.

Logs and artefacts

Robot suite output lands in test/uatools/logs/ (HTML + XML reports). The test/uatools/logs/ directory is in .gitignore; delete it freely between runs.