Java Testcontainers Dt logo

Java Testcontainers Dt

Community
q258523454
java-testcontainers-dt

Spring Boot 容器级 DT 测试编写指导(Testcontainers 模式)。触发场景:编写容器级 DT 测试、创建 Testcontainers 测试类、补充容器级用例。即使用户未明确说"Testcontainers",只要涉及容器级测试需求("写容器测试"、"写测试用例"、"写DT"、"补充 DT 测试"、"测试 MySQL/ES/Redis 真实交互"),都应使用此技能。基于 AIR、FIRST、BCDE 原则,指导 JUnit 5 + Testcontainers 容器级 DT 编写。

Overview

Publisherq258523454
Repositoryjava-testcontainers-dt
Skill namejava-testcontainers-dt
Stars
31
Forks
0
Bundled files
13
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 13 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by q258523454 on GitHub. Read the source before you install it.

Installation

Install the Java Testcontainers Dt AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/q258523454/java-testcontainers-dt/tree/main
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/q258523454/java-testcontainers-dt.git \
  .claude/skills/java-testcontainers-dt
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Java Testcontainers Dt in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Java Testcontainers Dt on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Java Testcontainers Dt is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Spring Boot 容器级 DT 测试编写指导(Testcontainers 模式)

UT、DT 与集成测试的区别

测试类型目标测试范围逻辑实现适用场景前置条件
UT 单元测试验证代码逻辑单个方法、类Mockito Mock 所有依赖,不加载 Spring 上下文纯逻辑验证、参数校验无
DT 开发测试(embedded)验证业务流程API 接口、业务场景@SpringBootTest + H2 + jedis-mock + WireMock业务流程验证,环境差异可接受无
DT 开发测试(Testcontainers)验证真实基础设施交互API 接口、完整业务场景@SpringBootTest + 真实容器(MySQL/Redis/ES)+ WireMockSQL 语法、JPA 映射、序列化、迁移脚本验证Docker 环境

触发场景

  • 编写容器级 DT 测试、创建 Testcontainers 测试类、补充容器级用例
  • 需要验证 SQL 语法、JPA 映射、Redis 序列化、ES 索引等真实基础设施交互
  • 创建 {被测类}Test 测试类

依赖要求

Java 21、JUnit 5、Testcontainers 1.16+、Spring Boot 3.1+、Docker

工作流程

  1. 确认测试模式:判断是否需要 Testcontainers(参考 DT决策树)
  2. 分析被测试代码:读取源码,识别依赖的中间件(MySQL/ES/Redis/Kafka),选择对应基类
  3. 设计测试用例(BCDE 原则):Border 边界值、Correct 正常场景、Design 结合设计文档、Error 异常场景。正常场景写在最前
  4. 编写测试代码:继承对应基类,遵循规范编写,参考下方文档
  5. 验证测试:运行测试确保通过,检查命名规范

规范文档(按需加载)

1. 核心规范(必读)

TestcontainersDT核心规范.md — 所有容器级 DT 必读

包含:DT vs UT 决策树、容器生命周期模式、Singleton Container 模式、@DynamicPropertySource 属性注入、基类设计、数据隔离策略、反模式

2. 组件容器测试规范(按中间件加载)

组件文档加载时机
MySQLMySQL容器测试规范.mdMySQL 交互时
ElasticsearchElasticsearch容器测试规范.mdES 交互时
RedisRedis容器测试规范.mdRedis 交互时

3. WireMock + Testcontainers(外部 HTTP 调用时加载)

WireMock用例编写规范.md — WireMock Standalone 指导

包含:WireMock + Testcontainers 组合模式、Stubbing、Request Matching、Verification

分工原则:WireMock 模拟外部 HTTP API,Testcontainers 提供真实中间件,Mockito 模拟本地依赖

4. 用例编写通用规范(编写用例时加载)

Java用例编写规范.md — 命名、断言、GWT 结构等通用规范

包含:AIR 原则、FIRST 原则、命名规范、GWT 结构、断言规范、异常测试

5. 目录结构规范(创建文件/目录时加载)

DT目录结构规范.md — 测试目录组织、文件放置、命名约定

包含:src/test/ 顶层结构、中间件测试数据目录、fixtures/migrations/seeds/testcontainers 四层组织

代码模板(按需加载)

基类模板

文件用途
AbstractTestcontainersTestcontainers.md通用容器级 DT 基类(MySQL + Redis + ES)
AbstractMySQLTestcontainers.md仅 MySQL 容器基类
AbstractElasticsearchTestcontainers.md仅 ES 容器基类
AbstractRedisTestcontainers.md仅 Redis 容器基类

配置模板

文件用途
testcontainers-properties.mdTestcontainers 全局配置
pom-dependencies.mdMaven 依赖清单

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Java Testcontainers Dt AI skill do?

Spring Boot 容器级 DT 测试编写指导(Testcontainers 模式)。触发场景:编写容器级 DT 测试、创建 Testcontainers 测试类、补充容器级用例。即使用户未明确说"Testcontainers",只要涉及容器级测试需求("写容器测试"、"写测试用例"、"写DT"、"补充 DT 测试"、"测试 MySQL/ES/Redis 真实交互"),都应使用此技能。基于 AIR、FIRST、BCDE 原则,指导 JUnit 5 + Testcontainers 容器级 DT 编写。

Why use Java Testcontainers Dt on TypingMind?

Because you install it once and use it with any model. Java Testcontainers Dt is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Java Testcontainers Dt in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/q258523454/java-testcontainers-dt/tree/main. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Java Testcontainers Dt?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Java Testcontainers Dt?

As many as you like. As long as a model supports skills, you can use Java Testcontainers Dt with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Java Testcontainers Dt AI skill free?

It is published on GitHub by q258523454. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇