6. Testing and Verification Layer
This document provides a detailed guide to testing and verification in the project. It expands on the testing section in GEMINI.md.
🧪 Testing Strategy
Section titled “🧪 Testing Strategy”- Unit Tests: Unit tests are used to test individual components, services, and pipes in isolation. They are written using Jasmine and run with Karma. The goal is to have high test coverage for all critical parts of the application.
- Integration Tests: Integration tests are used to test the interaction between different parts of the application, such as a component and a service. They are also written using Jasmine and run with Karma.
- End-to-End (E2E) Tests: E2E tests are used to test the application as a whole, from the user’s perspective. They are written using Cypress and run against a real browser.
✍️ Writing Good Tests
Section titled “✍️ Writing Good Tests”- Arrange, Act, Assert: All tests should follow the Arrange, Act, Assert pattern.
- Descriptive Names: Test descriptions should be clear and descriptive.
- Isolation: Unit tests should be isolated from each other. Use
beforeEachandafterEachto set up and tear down the test environment. - Mocks and Stubs: Use mocks and stubs to isolate the code being tested from its dependencies.
🛠️ Testing Tools and Frameworks
Section titled “🛠️ Testing Tools and Frameworks”- Jasmine: The testing framework for unit and integration tests.
- Karma: The test runner for unit and integration tests.
- Cypress: The framework for E2E tests(use this).
- Angular Testing Library: A library that provides utilities for testing Angular components.
Testing and Verification Checklist
Section titled “Testing and Verification Checklist”- All new features have unit tests with adequate coverage.
- All critical user flows are covered by E2E tests.
- All tests pass before a pull request is merged.
- The application has been manually tested on all supported browsers.
- The application has been tested for accessibility.