Skip to Content
TestingCustom Assertions

Custom Assertions

Define your own test criteria to verify specific functionality in your build.

Assertion Structure

{ "description": "Verify my application", "assertions": [ { "type": "service_running", "params": { "service": "myapp" } } ] }

Assertion Types

user_exists

Verify a user account exists with expected configuration.

{ "type": "user_exists", "params": { "username": "deploy", "groups": ["docker", "sudo"] } }
ParameterRequiredDescription
usernameYesUsername to check
groupsNoExpected group memberships
shellNoExpected login shell
homeNoExpected home directory

service_running

Check that a systemd service is active.

{ "type": "service_running", "params": { "service": "nginx" } }
ParameterRequiredDescription
serviceYesService unit name

service_enabled

Check that a service is enabled at boot.

{ "type": "service_enabled", "params": { "service": "docker" } }

package_installed

Verify a package is installed.

{ "type": "package_installed", "params": { "package": "nginx", "version": "1.24" } }
ParameterRequiredDescription
packageYesPackage name
versionNoExpected version (prefix match)

port_listening

Check that a port is open and listening.

{ "type": "port_listening", "params": { "port": 443, "protocol": "tcp" } }
ParameterRequiredDescription
portYesPort number
protocolNotcp or udp (default: tcp)
addressNoBind address (default: any)

http_responds

Verify an HTTP endpoint responds correctly.

{ "type": "http_responds", "params": { "url": "http://localhost:8080/health", "status": 200, "contains": "healthy" } }
ParameterRequiredDescription
urlYesURL to request
statusNoExpected HTTP status (default: 200)
containsNoResponse body must contain
methodNoHTTP method (default: GET)
timeoutNoRequest timeout in seconds

file_exists

Check that a file exists.

{ "type": "file_exists", "params": { "path": "/etc/myapp/config.yml" } }
ParameterRequiredDescription
pathYesFile path
modeNoExpected permissions (e.g., “0644”)
ownerNoExpected owner
groupNoExpected group

file_contains

Verify file contents.

{ "type": "file_contains", "params": { "path": "/etc/ssh/sshd_config", "content": "PermitRootLogin no" } }
ParameterRequiredDescription
pathYesFile path
contentYesString or regex to find
regexNoTreat content as regex

command_output

Run a command and check its output.

{ "type": "command_output", "params": { "command": "docker --version", "contains": "Docker version", "exit_code": 0 } }
ParameterRequiredDescription
commandYesCommand to execute
containsNoOutput must contain
exit_codeNoExpected exit code
timeoutNoCommand timeout in seconds

process_running

Check that a process is running.

{ "type": "process_running", "params": { "name": "nginx", "user": "www-data" } }
ParameterRequiredDescription
nameYesProcess name
userNoExpected user
countNoExpected process count

mount_exists

Verify a mount point exists.

{ "type": "mount_exists", "params": { "path": "/data", "fstype": "ext4" } }
ParameterRequiredDescription
pathYesMount point
fstypeNoFilesystem type

cis_benchmark

Run CIS benchmark checks. See CIS Benchmarks.

{ "type": "cis_benchmark", "params": { "level": 1, "profile": "server" } }

GUI & Display Testing

gui_application_opens

Launch a GUI application and verify its window appears.

{ "type": "gui_application_opens", "params": { "command": "firefox", "window_title": "Firefox", "timeout": 10 } }
ParameterRequiredDescription
commandYesCommand to launch application
window_titleYesExpected window title
timeoutNoSeconds to wait for window (default: 10)

gui_window_visible

Check if a window with specific title is visible.

{ "type": "gui_window_visible", "params": { "window_title": "EDC Login" } }
ParameterRequiredDescription
window_titleYesWindow title to check

gui_execute_command

Execute a command and capture a VNC screenshot.

{ "type": "gui_execute_command", "params": { "command": "weasis /opt/test-data/image.dcm", "wait_seconds": 5 } }
ParameterRequiredDescription
commandYesCommand to execute
wait_secondsNoWait time before screenshot (default: 2)

Automatically captures screenshot + metadata (PNG + JSON) for visual validation and FDA audit trails.

gui_application_process

Verify an application process is running.

{ "type": "gui_application_process", "params": { "process_name": "firefox" } }
ParameterRequiredDescription
process_nameYesProcess name to check

gui_screenshot_matches

Compare current screenshot against a reference image for visual regression testing.

{ "type": "gui_screenshot_matches", "params": { "reference_id": "login_screen_v1", "threshold": 0.95, "ignore_regions": [[10, 10, 200, 30]], "save_as_reference": false } }
ParameterRequiredDescription
reference_idYesUnique identifier for baseline image
thresholdNoSimilarity threshold 0.0-1.0 (default: 0.95)
ignore_regionsNoList of [x, y, width, height] regions to mask
match_areaNo[x, y, width, height] to crop both images
save_as_referenceNoSave current screenshot as new baseline
wait_beforeNoSeconds to wait before capture (default: 1.0)

Use for: Detecting UI regressions, verifying layouts, validating visual changes

gui_click_element

Click a UI element at specified screen coordinates.

{ "type": "gui_click_element", "params": { "x": 600, "y": 400, "button": "left", "double_click": false } }
ParameterRequiredDescription
xYesX coordinate
yYesY coordinate
buttonNoMouse button: left/right/middle (default: left)
double_clickNoClick twice (default: false)
wait_afterNoSeconds to wait after click (default: 0.5)
verify_clickNoCapture verification screenshot (default: true)

Use for: Navigating menus, clicking buttons, interacting with custom controls

gui_form_fill

Fill form fields and optionally submit.

{ "type": "gui_form_fill", "params": { "fields": [ {"name": "username", "value": "testuser", "method": "tab"}, {"name": "password", "value": "pass123", "method": "tab"} ], "submit_button": {"x": 600, "y": 500} } }
ParameterRequiredDescription
fieldsYesList of field objects (see below)
submit_buttonNo{x, y} coordinates to click after filling
wait_after_submitNoSeconds to wait after submit (default: 1.0)
verify_submissionNoCapture screenshot after submit (default: true)

Field object: {name, value, method, x, y, wait_after}

Use for: Automated data entry, form validation testing, workflow automation

gui_text_visible

Check if text is visible on screen using OCR.

Requires: pytesseract and tesseract-ocr system package

{ "type": "gui_text_visible", "params": { "text": "Login Successful", "case_sensitive": false } }
ParameterRequiredDescription
textYesText to search for
regionNo[x, y, width, height] to crop before OCR
case_sensitiveNoCase-sensitive search (default: false)
langNoTesseract language (default: eng)
wait_beforeNoSeconds to wait before capture (default: 1.0)

Use for: Verifying messages, checking labels, validating text in legacy apps

Natural Language Examples

Web Server Verification

Test that: - nginx is running - Port 80 is listening - http://localhost returns 200 - The homepage contains "Welcome"

Docker Setup

Verify Docker: - docker service is running - docker.sock exists - User 'deploy' can run docker commands - Can pull hello-world image

Security Checks

Security assertions: - SSH is on port 2222 - Root login is disabled - UFW is active - Only ports 22, 80, 443 are open

Complete Test Example

{ "tests": [ { "description": "Verify web application", "assertions": [ { "type": "service_running", "params": { "service": "nginx" } }, { "type": "port_listening", "params": { "port": 80 } }, { "type": "port_listening", "params": { "port": 443 } }, { "type": "http_responds", "params": { "url": "http://localhost/health", "status": 200 } } ] }, { "description": "Verify database", "assertions": [ { "type": "service_running", "params": { "service": "postgresql" } }, { "type": "port_listening", "params": { "port": 5432 } } ] } ] }

Test Failure Behavior

By default, test failures:

  • Are reported in detail
  • Don’t prevent ISO download
  • Are flagged with warnings

To make tests blocking:

These tests must pass before the build completes: - Application health check - Security baseline

Debugging Failed Tests

  1. View test logs in Build Details
  2. Check assertion details for specific errors
  3. Use VM Management to manually inspect the system
  4. Add debug commands like journalctl output