# testpilot-ai **Repository Path**: DamonT/testpilot-ai ## Basic Information - **Project Name**: testpilot-ai - **Description**: AI测试工具 - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-05-18 - **Last Updated**: 2026-05-26 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # TestPilot AI TestPilot AI is an AI-assisted testing workbench for QA engineers and small delivery teams. This MVP focuses on requirement analysis, structured testcase generation, and Excel export. ## Features - Requirement analysis from plain-text product requirements - Structured testcase generation with configurable case types and case count - Testcase table preview in the web UI - Excel export for generated testcases - API testcase generation from API documents or curl snippets - Bug analysis with structured report, causes, and developer checklist - Markdown test report generation - Recent generation history backed by SQLite - Chinese-first UI with Chinese/English language toggle - Local browser draft autosave and restore for core QA workflows - Dashboard resume entry for recent local drafts - Unified in-app feedback toasts for copy, download, and key save actions - Search and type filters for recent generation history - Dynamic dashboard metrics based on live history and local drafts - Dashboard loading skeletons and retryable history error states - Result-area skeletons and success feedback across core generation pages - Markdown and JSON export actions for analysis and API design outputs - Unified empty and error states across core workflow pages - Reusable form controls across generation and editing workflows - Local validation hints and disabled-state guidance before generation - Field-level validation guidance for testcase generation settings - Reusable selectable chip group with testcase type validation feedback - Refined testcase version save and selection feedback - Current draft summary inside testcase version management - Per-version match badges against the current testcase draft - Last-loaded badge and stable note preview in testcase version cards - Richer recent-history cards with selected state and compact preview summaries - Clear record metadata header inside dashboard history detail - Unified dashboard search and filter controls with shared form components - Shared section-level empty and error state component for dashboard surfaces - Shared section state now covers recent-history empty states as well - Testcase version management empty state now uses shared section state - Shared status badges across testcase version and dashboard history cards - Shared entity card header across history and testcase version cards - Shared quick action card component for dashboard entry points - Shared draft resume card component for dashboard saved-work items - Dashboard metric cards with icons and tone cues for faster scanability - Dashboard metric area now includes a lightweight section intro for quicker first-time orientation - Dashboard quick-action area now includes a lightweight section intro for clearer new-work entry points - Dashboard local-draft area now explicitly distinguishes browser-only draft recovery from shared history - Dashboard shared-history area now includes a lightweight section intro for review and replay workflows - Shared `SectionIntro` component now keeps dashboard section guidance visually consistent - Dashboard empty and error states now include clearer section-level titles for drafts and shared history - Dashboard section intros now support lightweight icons for faster visual scanning - Shared `SectionStack` now keeps dashboard section spacing and intro-to-content rhythm consistent - Requirement analysis and bug analysis pages now reuse `SectionStack` for their input/output workspace sections - API test generator and test report pages now reuse `SectionStack` for their input/output workspace sections - Testcase generator now reuses `SectionStack` for settings and generated-result workspaces - Testcase versioning and editor areas now also use page-level `SectionStack` wrappers - Shared `workspaceCopy` helper now keeps localized workspace titles, descriptions, and section state copy consistent across pages - Shared workspace section copy map now centralizes localized section titles and descriptions across workflow pages - Shared export filename helpers now keep download naming and report filename sanitization consistent across workflow pages - Shared markdown/json download helpers now keep export MIME types and success feedback consistent across workflow pages - Shared clipboard helpers now keep copy-result guards and toast behavior consistent across workflow pages - Shared toast helpers now keep success notification calls more readable across workflow pages - Shared guarded download helpers now keep export presence checks consistent across workflow pages - Shared async page action helper now keeps loading, error, and success flow consistent across core generation pages - Shared async page action helper now also supports dashboard loading flows with optional error-side cleanup - Shared `ResultHeaderActions` now keeps copy/export action groups consistent across core analysis and report pages - Shared `InputWorkspaceActions` now keeps sample/generate action groups consistent across core input workspaces - Shared `InputWorkspaceFeedback` now keeps draft/validation/error messaging consistent across core input workspaces - Shared `ContentState` now keeps simple result-or-empty rendering consistent across summary, report, and preview cards - Shared `KeyValueSummaryCard` now keeps summary grid cards consistent across requirement, API, and bug analysis pages - Shared `TextPreviewCard` now keeps plain-text and markdown result cards consistent across automation, bug report, and report preview blocks - Shared skeleton line/tile helpers now keep repeated loading placeholders consistent across analysis and report pages - Shared skeleton line/tile helpers now also keep dashboard history and detail loading placeholders consistent - Shared `DashboardHistorySkeleton` now keeps the home history loading block isolated and reusable - Quick structured summary headers inside history detail views - Field-level copy actions inside structured history summaries - Quick summary cards on requirement analysis and bug analysis pages - API test quick summary card with Markdown export - Editable testcase review before copy or Excel export - History detail view with workflow replay into generation pages - Saved testcase version snapshots with reload support - Testcase version rename and delete actions - Structured JSON preview inside history detail - Field-level copy actions in history detail - One-click single testcase copy from the testcase table - Markdown report export to `.md` - Unified backend AI service wrapper with local fallback output - Local fallback mode when no OpenAI-compatible credentials are configured ## Tech Stack - Frontend: React, TypeScript, Vite, Tailwind CSS, React Router, Axios - Backend: FastAPI, Pydantic, SQLAlchemy, SQLite, OpenAI-compatible API - Export: openpyxl ## Project Structure ```text testpilot-ai/ frontend/ src/ components/ pages/ services/ types/ utils/ backend/ app/ api/routes/ core/ schemas/ services/ docs/ ``` ## Getting Started ### 1. Start the backend ```bash cd backend python -m venv .venv .venv\Scripts\activate pip install -r requirements.txt copy .env.example .env uvicorn app.main:app --reload ``` Backend default URL: `http://127.0.0.1:8000` ### 2. Start the frontend ```bash cd frontend npm install npm run dev ``` Frontend default URL: `http://127.0.0.1:5173` ### 3. Optional frontend environment override Create `frontend/.env.local` when you want the frontend to call a custom backend URL instead of the Vite proxy: ```text VITE_API_BASE_URL=http://127.0.0.1:8000/api ``` ## Environment Variables Backend `.env`: ```text OPENAI_API_KEY= OPENAI_BASE_URL= MODEL_NAME=gpt-4o-mini DATABASE_URL=sqlite:///./testpilot.db ``` Notes: - `OPENAI_API_KEY` is optional in local development - if no AI credentials are configured, the backend returns deterministic fallback output - frontend never calls the model provider directly ## Implemented API - `POST /api/ai/analyze-requirement` - `POST /api/ai/generate-testcases` - `POST /api/ai/generate-api-tests` - `POST /api/ai/analyze-bug` - `POST /api/ai/generate-report` - `GET /api/ai/history/recent` - `GET /api/ai/history/{id}` - `POST /api/testcase-versions` - `GET /api/testcase-versions` - `GET /api/testcase-versions/{id}` - `PUT /api/testcase-versions/{id}` - `DELETE /api/testcase-versions/{id}` - `POST /api/export/testcases` ## Testing Backend automated tests: ```bash cd backend .venv\Scripts\activate pytest ``` Current coverage focus: - requirement analysis API - testcase generation API - Excel export API - API test generation, bug analysis, and report generation APIs - history detail API - testcase version save, load, update, and delete ## Deployment Notes ### Backend - run with `uvicorn app.main:app --host 0.0.0.0 --port 8000` - set `OPENAI_API_KEY`, `OPENAI_BASE_URL`, `MODEL_NAME`, and `DATABASE_URL` in the runtime environment - use a persistent database path or external database instead of ephemeral local storage in production - start from [backend/.env.production.example](E:\ai_project\testpilot-ai\backend\.env.production.example) when preparing a production deployment ### Frontend - build with `npm run build` - serve `frontend/dist/` with any static file server or reverse proxy - point `VITE_API_BASE_URL` to the deployed backend API when not using a local proxy - start from [frontend/.env.production.example](E:\ai_project\testpilot-ai\frontend\.env.production.example) for production environment variables ## Demo Assets - Demo walkthrough data: [docs/DEMO_DATA.md](E:\ai_project\testpilot-ai\docs\DEMO_DATA.md) - API reference: [docs/API_SPEC.md](E:\ai_project\testpilot-ai\docs\API_SPEC.md) - Prompt notes: [docs/PROMPTS.md](E:\ai_project\testpilot-ai\docs\PROMPTS.md) - Release checklist: [docs/RELEASE_CHECKLIST.md](E:\ai_project\testpilot-ai\docs\RELEASE_CHECKLIST.md) - Delivery summary: [docs/DELIVERY_SUMMARY.md](E:\ai_project\testpilot-ai\docs\DELIVERY_SUMMARY.md) ## Local Workflow 1. Open the dashboard 2. Paste a requirement into `Requirement Analysis` or `Testcase Generator` 3. Generate results from the backend 4. Review cases in the table or copy the generated content 5. Click any generated testcase row to edit it before export 6. Export generated testcases to Excel when needed 7. Use `API Test Generator`, `Bug Analyzer`, and `Test Report` for the broader QA workflow 8. Review recent generation results from the dashboard history panel and replay them back into the relevant page 9. Save important testcase snapshots as named versions and reload them later ## Delivery Status - Done: project scaffold - Done: backend AI wrapper and export APIs - Done: dashboard, requirement analysis page, testcase generation page - Done: API testcase generation page and endpoint - Done: bug analysis page and endpoint - Done: test report page and endpoint - Done: SQLite-backed generation history - Done: testcase editing, replay, and snapshot version management - Done: backend regression tests and production env templates - Done: demo data and release checklist documentation - Done: startup documentation ## Roadmap - Next: refine prompts and add richer structured editing workflows - Next: Jira and collaboration-tool integrations - Later: automation generation, project management workflows, and deeper reporting - Shared history detail action/content helpers now keep replay, copy, and preview layout consistent in the dashboard detail panel - Shared history detail key-value sections now keep metadata and summary blocks consistent in the dashboard detail panel - Shared `StatsStrip` now keeps testcase result and version summary strips visually consistent - Shared `TestcaseVersionCardMeta` now keeps testcase version card footer details consistent - Shared `TestcaseVersionCardActions` now keeps testcase version card action groups consistent across edit and view states - Shared `TestcaseVersionCardEditor` and `TestcaseVersionCardStateBadges` now keep testcase version card edit and badge blocks consistent - Shared `SelectableCard` now keeps selected card shells consistent between dashboard history items and testcase version cards - Shared `LabeledPreviewBlock` now keeps dashboard history previews and detail preview blocks visually aligned - Shared `formatDateTime` now keeps dashboard history and testcase version timestamps consistent from one utility - Shared `RecordIdChip` now keeps dashboard history record identifiers visually consistent - Shared `HistoryRecordCardBadges` now keeps dashboard history summary and selected badges consistent - Shared `TestcaseVersionCurrentDraftSummary` now keeps the testcase version panel draft summary block consistent - Shared `TestcaseVersionCard` now keeps testcase version card body composition consistent in one place - Shared `HistoryDetailBody` now keeps dashboard history detail composition in one reusable block - Shared `HistoryDetailLoadingState` now keeps dashboard history detail loading composition isolated from the panel shell - Shared `HistoryDetailState` now keeps dashboard history detail empty and error states aligned with the panel shell - Shared `TestcaseVersionList` now keeps testcase version list and empty-state switching isolated from the panel shell - Shared `matchesTestcaseVersionDraft` now keeps testcase draft alignment checks consistent between panel and list - Shared testcase version naming and saved-message helpers now keep default snapshot names and version success copy consistent - Shared `historyLabels` helpers now keep dashboard history type and summary labels consistent across list, detail, and filters - Shared `getHistoryTypeFilterOptions` now keeps dashboard history filter options built from the same label source - Shared `historyFilter` helpers now keep dashboard history query and type filtering logic in one place - Shared `formatCompactDateTime` now keeps compact draft timestamp formatting consistent across dashboard and draft status