| name | chatqna-run-unit-tests |
| description | Run ChatQnA Core unit tests for backend (pytest via uv) and frontend UI (vitest), including runtime selection (openvino or ollama), coverage options, and concise pass/fail evidence. Use this skill when the user says "run unit tests", "run backend tests", "run UI tests", "pytest", or "vitest".
|
| metadata | {"version":"1.0.0","tags":"chatqna tests unit-tests pytest vitest backend frontend openvino ollama"} |
| argument-hint | Describe what to test and scope, for example "run backend openvino tests", "run UI tests with coverage", or "run all unit tests".
|
ChatQnA Run Unit Tests
Run unit tests for Chat Question-and-Answer Core backend and frontend UI using
the repository-supported commands.
Codebase root: sample-applications/chat-question-and-answer-core/
What This Skill Produces
- Executed unit tests for one or both scopes:
- Backend (
pytest via uv run)
- Frontend UI (
vitest via npm run)
- Optional coverage execution for backend and UI.
- A concise test report containing:
- scope executed (backend/ui/both)
- runtime used for backend (
openvino or ollama)
- pass/fail status and failing test identifiers
- exact command(s) run as evidence
When to Use
- After user-visible application code changes in backend or UI, run unit tests by
default to validate regressions.
- Treat unit-test execution as the default post-change validation step unless the
user explicitly says not to run tests.
- Skip unit-test execution only when the user clearly opts out (for example:
"do not run tests", "skip unit tests", "no tests needed").
- "Run unit tests"
- "Run backend tests"
- "Run UI tests"
- "Run pytest"
- "Run vitest"
- "Run test coverage"
Inputs To Confirm
Before running commands, confirm or infer:
- Scope:
backend, ui, or both (default: both)
- Backend runtime:
openvino or ollama (default: openvino)
- Coverage mode:
on or off (default: off)
- Optional target narrowing (single file or test pattern)
If the user asks for "all unit tests", run backend + UI.
Decision Logic
- If scope is
backend:
- run backend test workflow only
- If scope is
ui:
- run UI test workflow only
- If scope is
both:
- run backend workflow first, then UI workflow
- If backend runtime is not provided:
- If coverage is requested:
- backend: add
--cov=app --cov-report=term-missing
- UI: use
npm run coverage
Workflow
Run from sample-applications/chat-question-and-answer-core.
1. Preflight
python3 --version
uv --version
node --version
npm --version
2. Backend Unit Tests
Install/sync dependencies if needed:
uv sync --all-groups
Run backend tests by runtime:
uv run pytest --model-runtime=openvino
uv run pytest --model-runtime=ollama
Backend coverage mode:
uv run pytest --model-runtime=openvino --cov=app --cov-report=term-missing
uv run pytest --model-runtime=ollama --cov=app --cov-report=term-missing
3. Frontend UI Unit Tests
Switch to UI directory and install deps if needed:
cd ui
npm install
Run UI tests:
npm run test
UI coverage mode:
npm run coverage
Optional interactive runner (only when explicitly requested):
npm run test:ui
4. Optional Targeted Test Runs
Backend single file:
uv run pytest tests/test_server.py --model-runtime=openvino
UI targeted pattern example:
cd ui
npm run test -- Conversation
Failure Handling
uv not installed:
- install
uv and re-run sync/tests
- Backend dependency or import failures:
- run
uv sync --all-groups and retry
npm or node_modules issues:
- run
npm install in ui/ and retry
- Runtime mismatch for backend tests:
- re-run with explicit
--model-runtime=openvino|ollama
- Failing tests:
- report failing test names and first actionable traceback lines
Completion Criteria
- Requested test scope (backend/ui/both) is executed.
- For backend, runtime selection is explicit (
openvino or ollama).
- If coverage requested, coverage command(s) are run.
- Response includes exact commands and pass/fail evidence.
- If failures occur, response includes failing tests and next actionable step.