scaffolding-oracle-to-postgres-migration-test-project
它能做什么
这个工具可以为 .NET 项目创建集成测试的基础结构。它会搭建一个用于测试 Oracle 数据库连接的环境,并确保测试不会永久修改数据。
适用场景
- ✓在开始为 Oracle 编写集成测试之前。
- ✓当你需要一个用于管理测试数据的模板时。
- ✓当你准备把项目从 Oracle 迁移到 PostgreSQL 时。
技能链接
https://github.com/github/awesome-copilot/blob/main/skills/scaffolding-oracle-to-postgres-migration-test-project/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“为我的主项目创建一个集成测试项目,并配置为使用 Oracle。”
每周 5 个新技能,1 分钟读完。
工作原理
该工具会创建一个新的测试项目,并连接到 Oracle 数据库。它还会设置一套机制,在每个测试开始时自动启动事务,测试结束后自动撤销,并提供一个用于加载测试数据的管理器。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Scaffolding an Integration Test Project for Oracle-to-PostgreSQL Migration
Creates a compilable, empty xUnit test project with transaction management and seed data infrastructure for a single target project. Run once per project before writing tests.
Workflow
Progress:
- [ ] Step 1: Inspect the target project
- [ ] Step 2: Create the xUnit test project
- [ ] Step 3: Implement transaction-rollback base class
- [ ] Step 4: Implement seed data manager
- [ ] Step 5: Verify the project compiles
Step 1: Inspect the target project
Read the target project's .csproj to determine the .NET version and existing package references. Match these versions exactly — do not upgrade.
Step 2: Create the xUnit test project
- Target the same .NET version as the application under test.
- Add NuGet packages for Oracle database connectivity (
Oracle.ManagedDataAccess.Core) and xUnit. - Add a project reference to the target project only — no other application projects.
- Add an
appsettings.jsonconfigured for Oracle database connectivity.
Step 3: Implement transaction-rollback base class
- Create a base test class that opens a transaction before each test and rolls it back after.
- Catch and handle all exceptions to guarantee rollback.
- Make the pattern inheritable by all downstream test classes.
Step 4: Implement seed data manager
- Create a global seed manager for loading test data within the transaction scope.
- Do not commit seed data — transactions roll back after each test.
- Do not use
TRUNCATE TABLE— preserve existing database data. - Establish a naming convention for seed file location that downstream test creation will follow.
Step 5: Verify the project compiles
Build the test project and confirm it compiles with zero errors before finishing.
Key Constraints
- Phase 3 only — this skill scaffolds the Oracle-targeting test project. The PostgreSQL test project (Phase 6) is created by copying and migrating this project; do not run this skill again at that point.
- Oracle is the golden behavior source — scaffold for Oracle only, not PostgreSQL.
- Keep to existing .NET and C# versions; do not introduce newer language or runtime features.
- Output is an empty test project with infrastructure only — no test cases.
常见问题
为什么不能在第 6 阶段使用这个工具?
在第 6 阶段,你需要把现有的测试项目迁移到 PostgreSQL。正确的做法是复制并修改第 3 阶段创建的项目,而不是再次运行这个工具。
什么是“种子数据”(seed data)?
“种子数据”是指你预先加载到数据库中、供测试使用的初始数据。每次测试结束后,这些数据会被自动删除。
什么是“事务回滚”(transaction-rollback)?
这是一种确保测试期间对数据库所做的更改,在测试结束时自动撤销的方法。这样可以保证你的原始数据安全。
详情
作者的原始描述
Scaffolds an xUnit integration test project targeting Oracle in .NET solutions. Creates the test project, transaction-rollback base class, and seed data manager. Use only during Phase 3, before writing Oracle baseline integration tests. Do not invoke during Phase 6 — the PostgreSQL test project is produced by migrating this project, not by running this skill again.
repo: github/awesome-copilot
热度
- GitHub 星标
- 40k
- 排名
- #7416
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
acquire-codebase-knowledge
40k帮你的智能体理解并编写现有代码项目的文档。它有助于新成员快速上手,或者快速了解项目架构。
acreadiness-assess
40k让你的智能体评估一个项目对 AI 的准备程度,并生成报告。它有助于了解项目在使用 AI 工具方面的准备情况。
acreadiness-generate-instructions
40k帮你的智能体根据评估结果编写 AI 工具的指令文件。它有助于改善 AI 与代码的交互方式,并弥补已发现的不足。
acreadiness-policy
40k让你的智能体协助制定或应用 AI 项目评估的政策。它有助于规范项目的评估方式,并确保合规。