# open-webui/tests architecture

> Architecture diagram of the GitHub repository open-webui/tests, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/open-webui/tests
- Repository: https://github.com/open-webui/tests

## Overview

This repository is an external regression suite for Open WebUI, not the application itself. Its main workflow is to start a scratch instance with controllable dependencies, exercise it through HTTP or a browser, and check observable results; unit and frontend tests cover behavior closer to the source. The README documents these suite layers and their roles. Source excerpts show selected harness implementations, but many test areas are unsampled, so their internal call relationships are not inferred.

Main entry points: [`harness/instance.py`](https://github.com/open-webui/tests/blob/main/harness/instance.py) (Scratch instance), [`conftest.py`](https://github.com/open-webui/tests/blob/main/conftest.py) (Pytest runner), [`integration`](https://github.com/open-webui/tests/tree/main/integration) (HTTP integration), [`e2e`](https://github.com/open-webui/tests/tree/main/e2e) (Browser tests)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_execution["Test execution"]
  node_pytest(("Pytest runner<br/>[conftest.py]"))
  node_integration["HTTP integration"]
  node_e2e["Browser tests"]
  node_unit["Backend unit tests"]
  node_frontend["Frontend tests"]
end

subgraph group_instance["Scratch instance"]
  node_scratch["Scratch instance<br/>[instance.py]"]
  node_backend["Open WebUI backend"]
  node_model["Scripted model provider<br/>[upstream.py]"]
  node_backends["Instance backends<br/>[backends.py]"]
  node_seeddata["Prepared data<br/>[prepared_data.py]"]
end

subgraph group_drivers["Test drivers"]
  node_httpclient["API clients<br/>[actors.py]"]
  node_socketclient["Socket client<br/>[socket_client.py]"]
  node_chatui["Chat UI helpers<br/>[chat_ui.py]"]
  node_providerchat["Chat scripting<br/>[chat.py]"]
end

subgraph group_support["Harness support"]
  node_listeners["Mock service listener<br/>[listener.py]"]
  node_serviceengines["Audio and image mocks"]
  node_objectstorage["Object storage mocks<br/>[object_storage.py]"]
  node_redisfake["Redis command stub<br/>[fake_redis.py]"]
  node_redisstate[("Stateful Redis<br/>[stateful_redis.py]")]
  node_redishash[("Hash Redis<br/>[hash_redis.py]")]
  node_seedscript["Upgrade data seeding"]
end

node_pytest -->|"boots"| node_scratch
node_pytest -->|"runs"| node_integration
node_pytest -->|"runs"| node_e2e
node_pytest -->|"runs"| node_unit
node_pytest -->|"runs"| node_frontend
node_integration -->|"drives HTTP"| node_scratch
node_e2e -->|"drives browser"| node_scratch
node_unit -->|"tests source"| node_backend
node_frontend -->|"imports src/lib"| node_backend
node_scratch -->|"starts"| node_backend
node_scratch -->|"configures"| node_model
node_scratch -->|"uses"| node_backends
node_integration -.->|"uses actors"| node_httpclient
node_integration -.->|"tests sockets"| node_socketclient
node_e2e -.->|"drives chat"| node_chatui
node_providerchat -->|"scripts replies"| node_model
node_listeners -->|"serves mocks"| node_serviceengines
node_seedscript -->|"creates data"| node_seeddata
node_redisstate -->|"falls back"| node_redisfake
node_redishash -->|"extends"| node_redisstate

click node_pytest "https://github.com/open-webui/tests/blob/main/conftest.py"
click node_integration "https://github.com/open-webui/tests/tree/main/integration"
click node_e2e "https://github.com/open-webui/tests/tree/main/e2e"
click node_unit "https://github.com/open-webui/tests/tree/main/unit"
click node_frontend "https://github.com/open-webui/tests/tree/main/frontend"
click node_scratch "https://github.com/open-webui/tests/blob/main/harness/instance.py"
click node_model "https://github.com/open-webui/tests/blob/main/harness/upstream.py"
click node_backends "https://github.com/open-webui/tests/blob/main/harness/backends.py"
click node_seeddata "https://github.com/open-webui/tests/blob/main/harness/prepared_data.py"
click node_httpclient "https://github.com/open-webui/tests/blob/main/harness/actors.py"
click node_socketclient "https://github.com/open-webui/tests/blob/main/harness/socket_client.py"
click node_chatui "https://github.com/open-webui/tests/blob/main/utils/chat_ui.py"
click node_providerchat "https://github.com/open-webui/tests/blob/main/harness/chat.py"
click node_listeners "https://github.com/open-webui/tests/blob/main/harness/listener.py"
click node_serviceengines "https://github.com/open-webui/tests/tree/main/harness"
click node_objectstorage "https://github.com/open-webui/tests/blob/main/harness/object_storage.py"
click node_redisfake "https://github.com/open-webui/tests/blob/main/integration/fake_redis.py"
click node_redisstate "https://github.com/open-webui/tests/blob/main/integration/stateful_redis.py"
click node_redishash "https://github.com/open-webui/tests/blob/main/integration/hash_redis.py"
click node_seedscript "https://github.com/open-webui/tests/blob/main/scripts/seed_upgrade_data.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_pytest,node_integration,node_e2e,node_unit,node_frontend toneBlue
class node_scratch,node_backend,node_model,node_backends,node_seeddata toneAmber
class node_httpclient,node_socketclient,node_chatui,node_providerchat toneMint
class node_listeners,node_serviceengines,node_objectstorage,node_redisfake,node_redisstate,node_redishash,node_seedscript toneRose
```

## Components

### Test execution

- [Pytest runner](https://github.com/open-webui/tests/blob/main/conftest.py): `conftest.py`
- [HTTP integration](https://github.com/open-webui/tests/tree/main/integration): `integration`
- [Browser tests](https://github.com/open-webui/tests/tree/main/e2e): `e2e`
- [Backend unit tests](https://github.com/open-webui/tests/tree/main/unit): `unit`
- [Frontend tests](https://github.com/open-webui/tests/tree/main/frontend): `frontend`

### Scratch instance

- [Scratch instance](https://github.com/open-webui/tests/blob/main/harness/instance.py): `harness/instance.py`
- **Open WebUI backend**
- [Scripted model provider](https://github.com/open-webui/tests/blob/main/harness/upstream.py): `harness/upstream.py`
- [Instance backends](https://github.com/open-webui/tests/blob/main/harness/backends.py): `harness/backends.py`
- [Prepared data](https://github.com/open-webui/tests/blob/main/harness/prepared_data.py): `harness/prepared_data.py`

### Test drivers

- [API clients](https://github.com/open-webui/tests/blob/main/harness/actors.py): `harness/actors.py`
- [Socket client](https://github.com/open-webui/tests/blob/main/harness/socket_client.py): `harness/socket_client.py`
- [Chat UI helpers](https://github.com/open-webui/tests/blob/main/utils/chat_ui.py): `utils/chat_ui.py`
- [Chat scripting](https://github.com/open-webui/tests/blob/main/harness/chat.py): `harness/chat.py`

### Harness support

- [Mock service listener](https://github.com/open-webui/tests/blob/main/harness/listener.py): `harness/listener.py`
- [Audio and image mocks](https://github.com/open-webui/tests/tree/main/harness): `harness`
- [Object storage mocks](https://github.com/open-webui/tests/blob/main/harness/object_storage.py): `harness/object_storage.py`
- [Redis command stub](https://github.com/open-webui/tests/blob/main/integration/fake_redis.py): `integration/fake_redis.py`
- [Stateful Redis](https://github.com/open-webui/tests/blob/main/integration/stateful_redis.py): `integration/stateful_redis.py`
- [Hash Redis](https://github.com/open-webui/tests/blob/main/integration/hash_redis.py): `integration/hash_redis.py`
- [Upgrade data seeding](https://github.com/open-webui/tests/blob/main/scripts/seed_upgrade_data.py): `scripts/seed_upgrade_data.py`

## Connections

- Pytest runner → Scratch instance: boots (evidence: `README.md`)
- Pytest runner → HTTP integration: runs (evidence: `README.md`)
- Pytest runner → Browser tests: runs (evidence: `README.md`)
- Pytest runner → Backend unit tests: runs (evidence: `README.md`)
- Pytest runner → Frontend tests: runs (evidence: `README.md`)
- HTTP integration → Scratch instance: drives HTTP (evidence: `README.md`)
- Browser tests → Scratch instance: drives browser (evidence: `README.md`)
- Backend unit tests → Open WebUI backend: tests source (evidence: `README.md`)
- Frontend tests → Open WebUI backend: imports src/lib (evidence: `README.md`)
- Scratch instance → Open WebUI backend: starts (evidence: `harness/instance.py`)
- Scratch instance → Scripted model provider: configures (evidence: `harness/instance.py`)
- Scratch instance → Instance backends: uses (evidence: `harness/instance.py`)
- HTTP integration → API clients: uses actors
- HTTP integration → Socket client: tests sockets
- Browser tests → Chat UI helpers: drives chat
- Chat scripting → Scripted model provider: scripts replies (evidence: `harness/chat.py`)
- Mock service listener → Audio and image mocks: serves mocks (evidence: `harness/audio_engine.py`)
- Upgrade data seeding → Prepared data: creates data (evidence: `scripts/seed_upgrade_data.py`)
- Stateful Redis → Redis command stub: falls back (evidence: `integration/stateful_redis.py`)
- Hash Redis → Stateful Redis: extends (evidence: `integration/hash_redis.py`)
