Skip to content

Add OpenSpec framework for unit test enhancement#159

Open
vishnuajayccst wants to merge 3 commits into
developfrom
specdrivenunittest
Open

Add OpenSpec framework for unit test enhancement#159
vishnuajayccst wants to merge 3 commits into
developfrom
specdrivenunittest

Conversation

@vishnuajayccst
Copy link
Copy Markdown
Contributor

OpenSpec Core Documents:

  1. proposal.md: Problem statement, goals, 7 requirements
  2. design.md: Technical architecture, mock patterns
  3. tasks.md: 56 tasks across 18 phases (P0-P2)
  4. status.md: Progress tracking

OpenSpec Workflow (.github):

  1. Prompts: explore, propose, apply, archive
  2. Skills: openspec-explore, openspec-propose, openspec-apply-change, openspec-archive-change

Key findings:

  1. 5 DAO types: CachedSimpleDAO (most common), SimpleDAO, ListingDAO (composite keys), CompressingDataDAO (compression+split), GroupServiceDAO (feature tags)
  2. 183 test scenarios documented across all spec files
  3. 3 infrastructure files to create: db/test_helpers_test.go, db/cleanup_tracker_demo_test.go, scripts/verify_coverage.sh + verify_idempotency.sh

- Added requirements for existing DAO tests to utilize CleanupTracker for cleanup operations.
- Refactored existing DAO tests in `dao_test.go` and `cached_simple_dao_test.go` to remove truncateTable calls and implement CleanupTracker.
- Introduced TEST_MODE environment variable to toggle between mock and real database executions.
- Created comprehensive test coverage for shared packages including estbfirmware, logupload, firmware, dcm, and rfc.
- Implemented Makefile targets for simplified test execution and coverage reporting.
- Added scripts for verifying test idempotency and coverage.
- Documented tasks for refactoring and adding missing tests across various packages.
- Established a configuration file for project context and artifact rules.
- Replace TEST_MODE environment variable with USE_MOCK_DB for better clarity in test execution modes.
- Implement TestableDAO interfaces and mock DAO structures to facilitate dependency injection in tests.
- Introduce CleanupTracker for managing test data cleanup, ensuring only test-inserted data is removed.
- Refactor existing tests to support both mock and real database modes, enhancing test isolation and reliability.
- Update Makefile targets to reflect new USE_MOCK_DB variable and ensure backward compatibility.
- Improve documentation and examples for the new testing patterns and CleanupTracker usage.
- Ensure all tests are idempotent and can run in any order without interference.
- Add comprehensive coverage verification for both mock and real database modes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant