β οΈ Work in Progress: This project is currently under active development. Features, APIs, and documentation may change without notice. Use at your own risk.
A modern, cloud-native test reporting and management platform built for the Cloudflare Workers ecosystem. TestCrate provides a comprehensive API for storing, organizing, and exporting test results with support for hierarchical builds, Allure integration, and multiple export formats.
- Project Management: Organize test results by projects with configurable categories
- Hierarchical Builds: Support for parent-child build relationships with nested test execution
- Test Artifacts Storage: Store and manage test results, containers, and attachments
- Role-Based Access Control: Three-tier authentication system (user, agent, admin)
- Real-time Status Tracking: Monitor build stages (scheduled, running, finished, interrupted)
- Allure Integration: Export test results in Allure format for rich HTML reports
- Markdown Reports: Generate human-readable markdown reports for build results
- Multiple Export Formats: Support for various output formats including tar archives
- Build Hierarchy Visualization: Export nested build structures with full context
- Cloudflare Workers: Built for edge computing with global distribution
- D1 Database: SQLite-compatible database for reliable data persistence
- TypeScript: Fully typed with Zod schema validation
- RESTful API: Comprehensive REST API with automatic request validation
- Monorepo Architecture: Modular design with separate packages for core, server, and database layers
TestCrate follows a modular monorepo architecture:
packages/
βββ core/ # Core business logic and schemas
βββ core-d1/ # D1 database implementation
βββ database-d1/ # Database utilities and migrations
βββ server/ # Cloudflare Workers server
- Controllers: Handle business logic for projects, builds, attachments, and stored items
- Export Controllers: Generate reports in Allure and Markdown formats
- Database Layer: D1-compatible database operations with migrations
- Authentication: JWT-based authentication with role-based permissions
- Schema Validation: Zod-powered request/response validation
- User: Read access to projects and builds
- Agent: Write access to builds and test artifacts
- Admin: Full access including project management and system operations
GET /api/v1/projects- List projectsGET /api/v1/projects/:projectId- Get project detailsPUT /api/v1/projects/:projectId- Create/update project (admin)PATCH /api/v1/projects/:projectId- Partial update (admin)DELETE /api/v1/projects/:projectId- Delete project (admin)
GET /api/v1/projects/:projectId/builds- List buildsGET /api/v1/projects/:projectId/builds/:buildId- Get build detailsGET /api/v1/projects/:projectId/builds/:buildId/all- Get build with childrenPUT /api/v1/projects/:projectId/builds/:buildId- Create/update build (agent)PATCH /api/v1/projects/:projectId/builds/:buildId- Update build status (agent)DELETE /api/v1/projects/:projectId/builds/:buildId- Delete build (admin)
GET /api/v1/projects/:projectId/builds/:buildId/items/:itemId- Get stored itemPUT /api/v1/projects/:projectId/builds/:buildId/items/:itemId- Store test result (agent)PATCH /api/v1/projects/:projectId/builds/:buildId/items/:itemId- Update item (agent)DELETE /api/v1/projects/:projectId/builds/:buildId/items/:itemId- Delete item (agent)
GET /api/v1/projects/:projectId/builds/:buildId/attachments- List attachmentsGET /api/v1/projects/:projectId/builds/:buildId/attachments/:attachmentId- Get attachmentPUT /api/v1/projects/:projectId/builds/:buildId/attachments/:attachmentId- Upload attachment (agent)
GET /api/v1/projects/:projectId/builds/:buildId/export/allure-results- Export as Allure resultsGET /api/v1/projects/:projectId/builds/:buildId/export/markdown- Export as Markdown report
- Node.js >= 20.18.0
- Yarn 4.9.2
- Cloudflare account (for deployment)
-
Clone the repository
git clone <repository-url> cd testcrate
-
Install dependencies
yarn install
-
Configure environment
# Copy example environment file cp packages/server/.dev.vars.example packages/server/.dev.vars # Edit .dev.vars with your API keys # USER_API_KEY=your-user-api-key # ADMIN_API_KEY=your-admin-api-key
-
Start development server
cd packages/server yarn dev
yarn build- Build the CLI and all packagesyarn test- Run tests across all packagesyarn lint- Lint all packagesyarn start- Start the CLI
TestCrate uses Cloudflare D1 for data persistence. The database schema is managed through migrations:
# View migration status
curl -H "Authorization: Bearer $ADMIN_API_KEY" \
http://localhost:8787/api/private/migrations/status
# Apply pending migrations (automatic on deployment)-
Configure Wrangler
cd packages/server npx wrangler login -
Set secrets
npx wrangler secret put USER_API_KEY npx wrangler secret put ADMIN_API_KEY
-
Deploy
yarn deploy
The wrangler.jsonc file contains the deployment configuration:
- D1 database binding:
testcrate_db - Node.js compatibility enabled
- Observability features enabled
- scheduled: Build created, waiting to start
- running: Actively executing
- finished: Execution completed
- interrupted: Cancelled/killed
- passed: All tests passed
- failed: Some tests failed
- broken: Build infrastructure issues
- skipped: Build was skipped
- unknown: Status not yet determined
- Allure Results: Individual test results
- Allure Containers: Test suites and containers
- Attachments: Files, screenshots, logs
curl -X PUT "https://your-worker.your-subdomain.workers.dev/api/v1/projects/my-project" \
-H "Authorization: Bearer $ADMIN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "My Test Project",
"description": "A comprehensive test suite"
}'curl -X PUT "https://your-worker.your-subdomain.workers.dev/api/v1/projects/my-project/builds/build-123" \
-H "Authorization: Bearer $AGENT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Integration Tests",
"stage": "scheduled",
"historyId": "a1b2c3d4e5f6789012345678901234567890abcdef"
}'curl -X PATCH "https://your-worker.your-subdomain.workers.dev/api/v1/projects/my-project/builds/build-123" \
-H "Authorization: Bearer $AGENT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"stage": "finished",
"status": "passed",
"stop": 1714857600
}'# Export as Allure results
curl -H "Authorization: Bearer $USER_API_KEY" \
"https://your-worker.your-subdomain.workers.dev/api/v1/projects/my-project/builds/build-123/export/allure-results" \
-o allure-results.tar
# Export as Markdown report
curl -H "Authorization: Bearer $USER_API_KEY" \
"https://your-worker.your-subdomain.workers.dev/api/v1/projects/my-project/builds/build-123/export/markdown" \
-o test-report.md- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
- Follow the existing code style and patterns
- Add tests for new functionality
- Update documentation as needed
- Ensure all tests pass before submitting
This project is licensed under the terms specified in the LICENSE file.
For questions, issues, or contributions, please:
- Open an issue on GitHub
- Check the existing documentation
- Review the API schemas in
packages/core/src/schema/
Built with β€οΈ for the testing community
