Loading...
Loading...
Test database interactions, schemas, and data integrity
npx skill4agent add wojons/skills testing-database# Database schema testing
npm run test:database:schema # Schema validation
npm run test:database:migrations # Migration testing
npm run test:database:rollback # Rollback procedure testing
# Data integrity testing
npm run test:database:crud # CRUD operation testing
npm run test:database:transactions # Transaction testing
npm run test:database:constraints # Constraint validation
# Performance testing
npm run test:database:performance # Query performance
npm run test:database:load # Concurrent load testing
npm run test:database:indexing # Index optimization testing
# Integration with other tests
npm run test:integration -- --database # Integration tests with database
npm run test:e2e -- --data-persistence # E2E with data validation
# Test database setup
npm run test:database:setup # Create test databases
npm run test:database:teardown # Clean up test data
npm run test:database:fixtures # Load test fixturesDatabase Test Results:
──────────────────────────────
Database System: PostgreSQL 15
Test Environment: Isolated test database
Schema Testing:
✅ Current schema matches ORM definitions
✅ Migration scripts apply correctly
✅ Rollback scripts revert successfully
✅ Indexes created as expected
Data Integrity:
✅ CRUD operations: 100% success
✅ Transactions: ACID properties verified
✅ Constraints: Foreign keys, unique, check constraints enforced
✅ Data types: Proper type handling and conversion
Performance Testing:
✅ Query Optimization: 45/50 queries optimized
⚠️ 5 complex queries need indexing review
✅ Connection Pooling: 100 concurrent connections handled
✅ Load Testing: 1000 transactions/minute sustained
✅ Response Times: 95% < 100ms
Integration with Other Tests:
- Unit tests: Use in-memory database or mocks
- Integration tests: Use test database with transactions
- API tests: Validate database interactions through API
- E2E tests: Full data flow from UI to database
- Performance tests: Include database performance metrics
Security Testing Integration:
✅ SQL injection prevention verified
✅ Access controls enforced at database level
✅ Sensitive data encryption tested
✅ Audit logging of database operations
Data Migration Testing:
✅ Migration from v1 to v2 successful
✅ Data loss: 0 records
✅ Downtime: 15 minutes (within SLA)
✅ Rollback tested and verified
Recommendation:
- Review 5 complex queries for indexing opportunities
- Implement connection health checks
- Add more comprehensive backup/restore testing
- Monitor database performance in production