Testing and Verification
Both backend templates ship executable contract tests asserting the same docs/contract/api.md, and all three frontend templates include Vitest unit tests and Playwright E2E tests. The scaffold CLI itself has no automated tests, so generator changes still use a manual verification process.
Contract Tests
Section titled “Contract Tests”# Python: 32 assertionscd templates/backend-pythonuv sync --extra devuv run ruff check .uv run pytest -q
# Java: 28 assertionscd templates/backend-javamvn spotless:checkmvn testThey cover the endpoint set, the response envelope (data must exist), resource field shapes, pagination clamping, token invalidation after logout, no partial writes on failure, SSRF rejection, and the export archive format.
Both suites also assert that every endpoint has a real response schema in OpenAPI: each one must have structured content, and successful responses must point at a concrete ApiResponse<T> generic. That is what lets a client generate types straight from /openapi.json instead of facing blank responses.
When changing the API, change the contract first, then both implementations and both test suites.
Frontend Tests
Section titled “Frontend Tests”All three frontend templates ship Vitest unit tests and Playwright E2E tests:
cd templates/frontend-react # or templates/frontend-vue / templates/frontend-sveltenpm testnpm run test:e2e # first run: npx playwright install chromiumReact/Vue use Testing Library; Svelte uses Vitest browser mode (vitest-browser-svelte) and can run svelte-check via npm run check.
Manual Verification
Section titled “Manual Verification”-
Generate a test project
终端窗口 npm run devChoose a frontend / backend combination and a project name to generate into the working directory.
-
Verify the frontend
终端窗口 cd <project>/frontendnpm installnpm run buildThe build should complete without errors. During development,
npm run devlets you check page rendering and API integration. -
Verify the backend
终端窗口 # Pythoncd <project>/backenduv syncJWT_SECRET_KEY="$(openssl rand -base64 48)" uv run uvicorn app.main:app --reload --host 127.0.0.1 --port 8088# Javacd <project>/backendmvn spring-boot:runConfirm the backend starts, initializes the database and writes seed data, and that you can log in with
admin / 123456. API docs are athttp://localhost:8088/docsin both stacks. -
Verify Docker
终端窗口 docker build -t test .docker run -p 5173:5173 -e JWT_SECRET_KEY="$(openssl rand -base64 48)" testVisit http://localhost:5173 to confirm the frontend loads and login works.
Menu and Data Management Checks
Section titled “Menu and Data Management Checks”- Log in as an administrator, open Menu & Permissions, drag to reorder groups and move an item across groups, refresh, and confirm the order persists.
- Create a custom menu, grant it to a role, and confirm it appears in the dynamic sidebar; delete it and confirm its operation permissions and grants disappear.
- Hide a menu, confirm the sidebar entry disappears while the route still opens directly, then show it again.
- Export full data, confirm the download and one-time password dialog, and verify the password cannot be displayed again after closing.
- Import the archive with the correct password and confirm ordinary APIs return
503during import and the job ends withsuccess. - After a successful import, confirm old tokens return
401and an administrator from the archive can log in. - Try a wrong password, damaged archive, and incompatible version; confirm rollback and that ordinary APIs recover.
Combinations to Cover
Section titled “Combinations to Cover”At minimum, verify the combinations affected by your changes. Because frontend and backend pair freely, when changing a frontend template you should also verify it against both the Python and Java backends; the same applies when changing a backend template.
Quick Verification Checklist
Section titled “Quick Verification Checklist”-
npm run build(scaffold) passes - Backend contract tests pass (
pytest/mvn test) - The generated project’s frontend build passes
- The backend starts and completes migrations and initialization
-
admin / 123456can log in -
/docsopens in both stacks - Permission menus display correctly by role
- Menu ordering, cross-group moves, and custom-menu permissions work
- The export archive decrypts and contains the full table manifest
- A successful import freezes ordinary requests and invalidates every session
- A failed import rolls back and releases the freeze
- Old tokens return
401after logout - The Docker image builds and runs