mirror of
https://github.com/apache/superset.git
synced 2026-05-22 16:25:49 +00:00
Snapshots all four versioned Docusaurus sections at v6.1.0, cut from master after the version-cutting tooling (#39837) and broken-internal- links fixes (#40102) landed. Captures fresh auto-generated content and freezes data dependencies so the historical snapshot stays correct. Versioning behavior: lastVersion stays at current for every section, so the canonical URLs (/docs/..., /admin-docs/..., /developer-docs/..., /components/...) continue to render content from master. The current version is consistently labeled "Next" with an unreleased banner, and 6.1.0 is a historical pin accessible only via its explicit version segment. Component playground: previously disabled: true in versions-config.json, now enabled and versioned. The plugin block in docusaurus.config.ts was already gated only by the disabled flag, so no other code changes were needed to bring it back online. Snapshot includes: - All MDX content for the four sections. - Auto-gen captured fresh: 74 database pages (engine spec metadata), ~1,800 API reference files (openapi.json), 59 component pages (Storybook stories). - Data imports frozen at cut time into snapshot-local _versioned_data/ dirs: versioned_docs/version-6.1.0/_versioned_data/src/data/databases.json (canonical 80-database diagnostics from master, preserved by the generator's input-hash cache) admin_docs_versioned_docs/version-6.1.0/_versioned_data/data/countries.json admin_docs_versioned_docs/version-6.1.0/_versioned_data/static/feature-flags.json developer_docs_versioned_docs/version-6.1.0/_versioned_data/static/data/components.json - Import paths in deeply-nested files rewritten so they still resolve from one directory deeper inside the snapshot. Verified via full yarn build: exit 0, no broken links surfaced by onBrokenLinks: throw. Anchor warnings present are pre-existing on master (community#superset-community-calendar) and unrelated.
5.7 KiB
5.7 KiB
title, sidebar_position
| title | sidebar_position |
|---|---|
| Overview | 1 |
Overview
Apache Superset follows a comprehensive testing strategy that ensures code quality, reliability, and maintainability. This section covers all aspects of testing in the Superset ecosystem, from unit tests to end-to-end testing workflows.
Testing Philosophy
Superset embraces a testing pyramid approach:
- Unit Tests: Fast, isolated tests for individual components and functions
- Integration Tests: Tests that verify component interactions and API endpoints
- End-to-End Tests: Full user journey testing in browser environments
Testing Documentation
Frontend Testing
- Frontend Testing - Jest, React Testing Library, and component testing strategies
Backend Testing
- Backend Testing - pytest, database testing, and API testing patterns
End-to-End Testing
- E2E Testing - Playwright testing for complete user workflows
CI/CD Integration
- CI/CD - Continuous integration, automated testing, and deployment pipelines
Testing Tools & Frameworks
Frontend
- Jest: JavaScript testing framework for unit and integration tests
- React Testing Library: Component testing utilities focused on user behavior
- Playwright: Modern end-to-end testing for web applications
- Storybook: Component development and visual testing environment
Backend
- pytest: Python testing framework with powerful fixtures and plugins
- SQLAlchemy Test Utilities: Database testing and transaction management
- Flask Test Client: API endpoint testing and request simulation
Best Practices
Writing Effective Tests
- Test Behavior, Not Implementation: Focus on what the code should do, not how it does it
- Keep Tests Independent: Each test should be able to run in isolation
- Use Descriptive Names: Test names should clearly describe what is being tested
- Arrange, Act, Assert: Structure tests with clear setup, execution, and verification phases
Test Organization
- Colocation: Place test files near the code they test
- Naming Conventions: Use consistent naming patterns for test files and functions
- Test Categories: Organize tests by type (unit, integration, e2e)
- Test Data Management: Use factories and fixtures for consistent test data
Running Tests
Quick Commands
# Frontend unit tests
npm run test
# Backend unit tests
pytest tests/unit_tests/
# End-to-end tests
npm run playwright:test
# All tests with coverage
npm run test:coverage
Test Development Workflow
- Write Failing Test: Start with a test that describes the desired behavior
- Implement Feature: Write the minimum code to make the test pass
- Refactor: Improve code quality while keeping tests green
- Verify Coverage: Ensure adequate test coverage for new code
Testing in Development
Test-Driven Development (TDD)
- Write tests before implementation
- Use tests to guide design decisions
- Maintain fast feedback loops
Continuous Testing
- Run tests automatically on code changes
- Integrate testing into development workflow
- Use pre-commit hooks for test validation
Getting Started
- Set up Testing Environment: Follow the development setup guide
- Run Existing Tests: Familiarize yourself with the test suite
- Write Your First Test: Start with a simple unit test
- Learn Testing Patterns: Study existing tests for patterns and conventions
Topics to be covered:
- Testing strategy and pyramid
- Test-driven development (TDD) for plugins
- Continuous integration and automated testing
- Code coverage and quality metrics
- Testing tools and frameworks overview
- Mock data and test fixtures
- Performance testing and benchmarking
- Accessibility testing automation
- Cross-browser and device testing
- Regression testing strategies
Testing Levels
Unit Testing
- Component testing - Individual React components
- Function testing - Data transformation and utility functions
- Hook testing - Custom React hooks
- Service testing - API clients and business logic
Integration Testing
- API integration - Backend service communication
- Component integration - Multi-component workflows
- Data flow testing - End-to-end data processing
- Plugin lifecycle testing - Installation and activation
End-to-End Testing
- User workflow testing - Complete user journeys
- Cross-browser testing - Browser compatibility
- Performance testing - Load and stress testing
- Accessibility testing - Screen reader and keyboard navigation
Testing Tools
- Jest - Unit and integration testing framework
- React Testing Library - Component testing utilities
- Playwright - End-to-end testing (replacing Cypress)
- Storybook - Component development and testing
This documentation is under active development. Check back soon for updates!