鱼皮AI导航
鱼皮AI导航
  • 主页
  • 社区
  • AI工具
  • AI知识库
  • AI提示词
  • MCP
  • Skills
  • AI学习资源
  • AI资讯
  • GitHub开源
登录/注册

testing

执行并调试 DBHub 项目的单元测试与集成测试,支持多种数据库环境下的自动化测试流程,能够定位测试失败原因、处理容器化数据库启动问题,并验证代码变更的正确性,适用于本地开发与 CI/CD 场景。

测试与安全
访问 GitHub
文档Skills.MD
name
testing
description
Run and troubleshoot tests for DBHub, including unit tests, integration tests with Testcontainers, and database-specific tests. Use when asked to run tests, fix test failures, debug integration tests, or troubleshoot Docker/database container issues.

Testing Skill

This skill helps you run and troubleshoot tests in the DBHub project.

Quick Commands

Before running tests, consult TESTING.md for comprehensive documentation.

Common test commands:

  • pnpm test - Run all tests
  • pnpm test:watch - Run tests in watch mode
  • pnpm test:integration - Run integration tests (requires Docker)
  • pnpm test src/connectors/__tests__/{db-type}.integration.test.ts - Test specific database connector

Integration Testing

Integration tests use Testcontainers to run real database instances in Docker.

Prerequisites Checklist

Before running integration tests, verify:

  1. Docker is installed and running: docker ps
  2. Sufficient Docker memory allocated (4GB+ recommended)
  3. Network access to pull Docker images

Database-Specific Tests

Test individual database connectors:

▼
bash
复制代码
# PostgreSQL pnpm test src/connectors/__tests__/postgres.integration.test.ts # MySQL pnpm test src/connectors/__tests__/mysql.integration.test.ts # MariaDB pnpm test src/connectors/__tests__/mariadb.integration.test.ts # SQL Server pnpm test src/connectors/__tests__/sqlserver.integration.test.ts # SQLite pnpm test src/connectors/__tests__/sqlite.integration.test.ts # JSON RPC integration pnpm test src/__tests__/json-rpc-integration.test.ts

Troubleshooting

Container Startup Issues

If containers fail to start:

▼
bash
复制代码
# Verify Docker is running docker ps # Check disk space docker system df # Manually pull images docker pull postgres:15-alpine docker pull mysql:8.0 docker pull mariadb:10.11 docker pull mcr.microsoft.com/mssql/server:2019-latest

SQL Server Timeout Issues

SQL Server containers require 3-5 minutes to start:

  • Ensure Docker has 4GB+ memory allocated
  • Run SQL Server tests separately: pnpm test src/connectors/__tests__/sqlserver.integration.test.ts
  • Check timeout settings in test files

Debug Failed Tests

▼
bash
复制代码
# Run with verbose output pnpm test:integration --reporter=verbose # Run specific test pattern pnpm test:integration -- --testNamePattern="PostgreSQL" # Check container logs docker logs <container_id>

Test Architecture

All integration tests follow this pattern:

  1. Container Lifecycle: Start database container → Connect → Setup test data → Run tests → Cleanup
  2. Shared Test Utilities: Common patterns in IntegrationTestBase class
  3. Database-Specific Features: Each database tests unique capabilities
  4. Error Handling: Comprehensive testing of connection errors, invalid SQL, edge cases

When to Use This Skill

Use this skill when:

  • Asked to run tests or verify code changes
  • Debugging test failures
  • Setting up integration tests for new features
  • Troubleshooting Docker or Testcontainers issues
  • Adding new database connector tests
  • Investigating CI/CD test failures

Related Files

  • TESTING.md - Comprehensive testing documentation
  • src/connectors/__tests__/ - Integration test files
  • vitest.config.ts - Vitest configuration
  • .github/workflows/ - CI/CD test workflows
测试与安全

快捷安装

复制到终端去安装 Skill

npxskillsaddbytebase/dbhub--skill"testing"
站长:程序员鱼皮 老鱼简历 商务合作 增值电信业务经营许可证
2026 鱼皮AI导航 | 沪ICP备19026706号-6
站长:程序员鱼皮 老鱼简历 商务合作 增值电信业务经营许可证
2026 鱼皮AI导航 | 沪ICP备19026706号-6
🔥热门工具
朱雀AI检测朱雀AI检测
朱雀AI检测助手朱雀AI检测助手
LovartLovart
老鱼简历老鱼简历
WritePass官网WritePass官网
面多多面多多
CursorCursor
星月写作星月写作
朱雀AI检测助手朱雀AI检测助手
零感AI零感AI
Skills 推荐
debug
debug 是一个系统化定位软件缺陷根因的技能,适用于用户报告 'fix'、'broken'、'error' 等问题或测试意外失败时。它通过可验证的假设、最小复现、因果链分析和回归测试,确保在修复前准确定位根本原因。
webapp-testing
提供本地 Web 应用的端到端测试能力,支持页面导航、元素交互、表单填写、动态等待、断言验证、截图捕获、浏览器日志收集及网络请求拦截,适用于前端功能验证与 UI 行为调试。
tdd-process
严格遵循测试驱动开发的红绿重构循环,强制执行先写测试、失败要有意义、实现最小化、验证全覆盖的全流程,确保每次代码变更都由可执行的测试用例驱动并经编译、检查与全量验证确认。
smoke-test
自动化创建 Mastra 项目并完成 Studio 全流程冒烟测试,涵盖项目初始化、环境配置、本地服务启动及 Chrome 浏览器中对 Agents、Tools、Workflows、Scorers 等核心模块的功能验证与截图记录。
property-based-testing
通过生成随机输入验证代码在各类边界条件下的行为一致性,适用于序列化、解析、归一化及纯函数等场景,能有效发现隐含缺陷并提升测试覆盖率,尤其适合需要高可靠性的算法与智能合约验证。