managing-database-tests
Database testing including fixtures, transactions, and rollback management. Use when performing specialized testing. Trigger with phrases like "test the database", "run database tests", or "validate data integrity".
- License 许可
- MIT
- 最近更新
- 2025-12-18
- Stars
- ★ 29
- Forks
- 9
01 前言 Front Matter
- name
- managing-database-tests
- license
- MIT
- version
- 1.0.0
- description
- Database testing including fixtures, transactions, and rollback management. Use when performing specialized testing. Trigger with phrases like "test the database", "run database tests", or "validate data integrity".
- allowed-tools
- Read, Write, Edit, Grep, Glob, Bash(test:db-*)
02 资源文件 13
- 资产文件assets/database_schema_definition.json4.0 KB
- 资产文件assets/docker-compose.yml2.5 KB
- 资产文件assets/example_migration_script.sql1.7 KB
- 资产文件assets/README.md385 B
- 资产文件assets/test_data_schema_template.json3.4 KB
- 参考文档references/api_reference.md6.2 KB
- 参考文档references/evidence_types.md8.6 KB
- 参考文档references/README.md687 B
- 参考文档references/target_annotations.md10.1 KB
- 脚本scripts/generate_test_data.py3.6 KB
- 脚本scripts/query_opentargets.py10.4 KB
- 脚本scripts/README.md501 B
- 脚本scripts/wrap_in_transaction.py2.9 KB
03 SKILL.md 正文
Prerequisites
Before using this skill, ensure you have:
- Test environment configured and accessible
- Required testing tools and frameworks installed
- Test data and fixtures prepared
- Appropriate permissions for test execution
- Network connectivity if testing external services
Instructions
Step 1: Prepare Test Environment
Set up the testing context:
- Use Read tool to examine configuration from {baseDir}/config/
- Validate test prerequisites are met
- Initialize test framework and load dependencies
- Configure test parameters and thresholds
Step 2: Execute Tests
Run the test suite:
- Use Bash(test:db-*) to invoke test framework
- Monitor test execution progress
- Capture test outputs and metrics
- Handle test failures and error conditions
Step 3: Analyze Results
Process test outcomes:
- Identify passed and failed tests
- Calculate success rate and performance metrics
- Detect patterns in failures
- Generate insights for improvement
Step 4: Generate Report
Document findings in {baseDir}/test-reports/:
- Test execution summary
- Detailed failure analysis
- Performance benchmarks
- Recommendations for fixes
Output
The skill generates comprehensive test results:
Test Summary
- Total tests executed
- Pass/fail counts and percentage
- Execution time metrics
- Resource utilization stats
Detailed Results
Each test includes:
- Test name and identifier
- Execution status (pass/fail/skip)
- Actual vs. expected outcomes
- Error messages and stack traces
Metrics and Analysis
- Code coverage percentages
- Performance benchmarks
- Trend analysis across runs
- Quality gate compliance status
Error Handling
Common issues and solutions:
Environment Setup Failures
- Error: Test environment not properly configured
- Solution: Verify configuration files; check environment variables; ensure dependencies are installed
Test Execution Timeouts
- Error: Tests exceeded maximum execution time
- Solution: Increase timeout thresholds; optimize slow tests; parallelize test execution
Resource Exhaustion
- Error: Insufficient memory or disk space during testing
- Solution: Clean up temporary files; reduce concurrent test workers; increase resource allocation
Dependency Issues
- Error: Required services or databases unavailable
- Solution: Verify service health; check network connectivity; use mocks if services are down
Resources
Testing Tools
- Industry-standard testing frameworks for your language/platform
- CI/CD integration guides and plugins
- Test automation best practices documentation
Best Practices
- Maintain test isolation and independence
- Use meaningful test names and descriptions
- Keep tests fast and focused
- Implement proper setup and teardown
- Version control test artifacts
- Run tests in CI/CD pipelines
04 同仓库更多 Skills
UI 视觉回归测试
testing-visual-regression
使用截图比较检测 UI 组件中的视觉变化。 在检测意外的 UI 更改或像素差异时使用。 用“测试视觉变化”、“比较截图”或“检测 UI 回归”等短语触发。
单元测试自动生成
generating-unit-tests
从源代码自动生成全面的单元测试,覆盖正常路径、边界条件和错误情况。 在为函数、类或模块创建测试覆盖时使用。 用“生成单元测试”、“为…创建测试”或“添加测试覆盖”等短语触发。
测试报告生成与可视化
generating-test-reports
生成包含指标、覆盖率和可视化内容的全面测试报告。 在执行专项测试时使用。 用“生成测试报告”、“创建测试文档”或“显示测试指标”等短语触发。
测试执行编排与协调
orchestrating-test-execution
协调跨多个环境和框架的并行测试执行。 在执行专项测试时使用。 用“编排测试”、“运行并行测试”或“协调测试执行”等短语触发。
managing-test-environments
Provision and manage isolated test environments with configuration and data. Use when performing specialized testing. Trigger with phrases like "manage test environment", "provision test env", or "setup test infrastructure".
generating-test-doubles
Generate mocks, stubs, spies, and fakes for dependency isolation. Use when creating mocks, stubs, or test isolation fixtures. Trigger with phrases like "generate mocks", "create test doubles", or "setup stubs".