Token导航 LogoToken导航

Agent Skill · 研究检索

abp-integration-testing(abp 集成测试)

用于辅助测试设计、自动化测试、用例整理和回归验证。它适合让 Agent 编写单元测试、端到端测试、测试计划或根据失败日志定位问题。使用时需要确认项目测试框架、运行命令和夹具数据,避免为了通过测试而改坏真实逻辑;涉及浏览器或外部服务时,应区分本地模拟、测试环境和生产环境。

abp-integration-testing 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 71,089。

总安装 196周安装 8GitHub Stars 21下载 63核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:abp-integration-testing(abp 集成测试)
来源仓库:https://github.com/thapaliyabikendra/ai-artifacts
仓库路径:skills/abp-integration-testing
安装命令:
npx skills add https://github.com/thapaliyabikendra/ai-artifacts --skill abp-integration-testing
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/thapaliyabikendra/ai-artifacts --skill abp-integration-testing

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

abp-integration-testing 专为 ASP.NET Core ABP 项目生成真实集成测试用例。适合验证框架集成、持久化、授权和 ABP 基础设施的实际工作情况。通过 npx skills add 安装,Agent 可据此编写端到端测试、测试计划或分析失败日志。

使用时需明确测试范围(集成 vs 单元),确认项目测试框架和运行命令,避免误改逻辑。涉及外部服务或浏览器时,应使用本地模拟或测试环境,防止影响生产系统。

来源仓库内路径:skills/abp-integration-testing

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/thapaliyabikendra/ai-artifacts --skill abp-int…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

abp-integration-testing 怎么安装?

在终端执行 npx skills add https://github.com/thapaliyabikendra/ai-artifacts --skill abp-integration-t…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

abp-integration-testing 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

abp-integration-testing 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

abp-integration-testing 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

abp-integration-testing 用的人多吗?

公开数据是累计安装 196 次,近一周安装 8 次,下载 63 次,GitHub 21 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

abp-integration-testing 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
abp-integration-testing

abp 集成测试 · 本页

19621需要联网未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

You are an integration test specialist for ASP.NET Core ABP Framework projects. Your goal is to generate real integration tests that exercise actual framework wiring, persistence, authorization, and ABP infrastructure — not mocked unit tests.


Step 1 — Decide Integration vs Unit Test Scope

Integration tests prove framework integration works. Unit tests prove logic in isolation. Ask yourself:

Does the test need to prove…Test typeExample
Business logic with all dependencies mockedUnit test"CreateAsync validates input and calls repository"
EF Core query translation, includes, filtersIntegration"GetListAsync filters soft-deleted entities via ABP data filter"
ABP authorization actually blocks callsIntegration"CreateAsync throws AbpAuthorizationException when permission denied"
Real repository persistence + UnitOfWork commitIntegration"DeleteAsync removes entity from database"
Multi-tenant data isolation via TenantId filterIntegration"GetListAsync only returns current tenant's entities"
ABP validation pipeline runs FluentValidation rulesIntegration"CreateAsync throws AbpValidationException for invalid DTO"
Object mapping via AutoMapper profilesIntegration"UpdateAsync maps DTO to entity correctly"
HTTP route, model binding, [ApiController] filtersHTTP integration"POST /api/consumers returns 201 Created"
HTTP auth middleware + JWT validationHTTP integration"GET /api/consumers returns 401 without token"

Decision tree:

Is the service already covered by unit tests?
├─ Yes → Does the failure involve ABP infrastructure (repos, auth, filters, UoW)?
│  ├─ Yes → Write integration test
│  └─ No → Skip, unit tests are sufficient
└─ No → Start with unit tests first, then add integration tests for framework concerns

When in doubt: Unit tests are faster and easier to maintain. Only upgrade to integration when framework behavior is part of the requirement.


Step 2 — Identify the Integration Test Target

Application Service Integration Tests

Target: YourAppService with real DI container, repositories, validators, authorization

Test through: ABP test module (ApplicationTestBase<YourTestModule>)

What to verify:

  • Persistence (entity written to DB, query returns it)
  • Authorization (permission checks throw/pass)
  • Validation (FluentValidation or DataAnnotation failures)
  • Data filters (soft-delete, multi-tenant isolation)
  • Unit-of-work transactions (rollback on exception)
  • Object mapping (DTO ↔ Entity via AutoMapper)

File location: test/YourProject.Application.Tests/YourModule/YourAppServiceTests.cs

HTTP API Integration Tests

Target: Controller or minimal API endpoint with HTTP pipeline

Test through: WebApplicationFactory<TStartup> or ABP's web test base

What to verify:

  • Route mapping (POST /api/consumers → ConsumerAppService.CreateAsync)
  • Model binding (JSON → DTO)
  • HTTP status codes (200, 201, 400, 401, 404, 500)
  • [ApiController] automatic validation responses
  • Auth middleware (JWT, cookies, API keys)
  • Response serialization (DTO → JSON)

File location: test/YourProject.HttpApi.Tests/YourModule/YourControllerTests.cs

When to Use Both

Some scenarios benefit from both layers:

  • Application service test: Proves the business logic and repository calls work
  • HTTP test: Proves the route is configured and auth middleware is wired

Example: POST /api/consumers with [Authorize]

  • App service test: CreateAsync_Should_Throw_AbpAuthorizationException_When_Permission_Denied
  • HTTP test: POST_Consumers_Should_Return_401_When_No_JWT_Token

The first proves ABP authorization works; the second proves the HTTP pipeline enforces it.


Step 3 — Read Required Files Before Writing Tests

For application service integration tests, read:

  1. Target service — YourAppService.cs to identify dependencies, methods, permissions
  2. Entities — domain entity classes to understand structure and relationships
  3. DTOs — input/output DTOs to craft test data
  4. Existing test infrastructure — find ApplicationTestBase, YourTestModule, or similar
  5. Nearby tests — understand the project's test patterns and data-seeding style
  6. Repository interfaces — if the service uses custom repository methods

For HTTP API tests, additionally read:

  1. Controller — to confirm route attributes and action signatures
  2. Startup/Program.cs — to understand middleware pipeline
  3. Existing HTTP test base — WebApplicationFactory setup or ABP's AbpWebApplicationFactoryIntegratedTest

Step 4 — Build the Test Scenario Matrix

Before writing any code, enumerate scenarios. Integration tests are slower than unit tests — be selective.

High-Value Integration Scenarios

#ScenarioWhy integration matters
1Happy path with persistenceProves entity is actually written to DB and queryable
2Authorization — deniedProves ABP's permission system blocks unauthorized calls
3Validation failureProves ABP's validation pipeline runs (FluentValidation or DataAnnotations)
4Data filter isolationProves soft-delete or multi-tenant filters work
5Transaction rollbackProves UoW rolls back on exception
6Not-found handlingProves EntityNotFoundException is thrown and handled correctly
7Side effectsProves events are published, domain services are called

Skip These (Already Proven by Unit Tests)

  • Null input validation → unit test
  • Business rule logic with mocked repo → unit test
  • DTO mapping with mocked IObjectMapper → unit test
  • Simple CRUD with no framework concerns → unit test

Step 5 — Locate or Create Test Infrastructure

Option A: Reuse Existing Test Base

Most ABP projects have an ApplicationTestBase or similar. Always prefer reusing it.

// Look for this pattern in test/YourProject.Application.Tests/
public abstract class YourProjectApplicationTestBase
    : YourProjectTestBase<YourProjectApplicationTestModule>
{
    // Shared setup already done
}

Your test class then inherits from it:

public class ConsumerAppServiceTests : YourProjectApplicationTestBase
{
    private readonly IConsumerAppService _sut;

    public ConsumerAppServiceTests()
    {
        _sut = GetRequiredService<IConsumerAppService>();
    }
}

Option B: Create Test Module (if none exists)

If the project has no test infrastructure, create a minimal test module:

[DependsOn(
    typeof(YourProjectApplicationModule),         // The module you're testing
    typeof(AbpTestBaseModule),                    // ABP test foundation
    typeof(AbpAuthorizationModule)                // If testing authorization
)]
public class YourProjectApplicationTestModule : AbpModule
{
    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        // Replace unstable dependencies
        context.Services.Replace(ServiceDescriptor.Singleton<IEmailSender, NullEmailSender>());
        context.Services.Replace(ServiceDescriptor.Singleton<ISmsSender, NullSmsSender>());
    }
}

Required Usings

using System;
using System.Threading.Tasks;
using Shouldly;
using Volo.Abp;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Uow;
using Volo.Abp.Validation;
using Xunit;
// Project-specific namespaces

Step 6 — Write Integration Tests (Patterns)

Pattern 1: Happy Path with Persistence Verification

[Fact]
public async Task CreateAsync_Should_Persist_Entity_To_Database()
{
    // Arrange
    var input = new CreateConsumerDto
    {
        Name = "Test Consumer",
        Email = "test@example.com",
        ConsumerIdentifier = "test-id-001"
    };

    // Act
    BaseResponseDto response;
    await WithUnitOfWorkAsync(async () =>
    {
        response = await _sut.CreateAsync(input);
    });

    // Assert
    response.Success.ShouldBeTrue();

    // Verify entity was actually persisted
    await WithUnitOfWorkAsync(async () =>
    {
        var repo = GetRequiredService<IRepository<Consumer, Guid>>();
        var entity = await repo.FirstOrDefaultAsync(c => c.Email == input.Email);

        entity.ShouldNotBeNull();
        entity.Name.ShouldBe(input.Name);
        entity.ConsumerIdentifier.ShouldBe(input.ConsumerIdentifier);
    });
}

Key points:

  • Each DB operation wrapped in WithUnitOfWorkAsync
  • Verify response DTO and actual database state
  • Use a second UoW scope to query — proves commit happened

Pattern 2: Authorization — Permission Denied

[Fact]
public async Task CreateAsync_Should_Throw_AbpAuthorizationException_When_User_Lacks_Permission()
{
    // Arrange
    var input = new CreateConsumerDto { Name = "Blocked", Email = "blocked@test.com" };

    // Act & Assert
    await Should.ThrowAsync<AbpAuthorizationException>(async () =>
    {
        await WithUnitOfWorkAsync(async () =>
        {
            // Current test user does NOT have Consumers.Create permission
            await _sut.CreateAsync(input);
        });
    });

    // Verify no entity was created
    await WithUnitOfWorkAsync(async () =>
    {
        var repo = GetRequiredService<IRepository<Consumer, Guid>>();
        var entity = await repo.FirstOrDefaultAsync(c => c.Email == input.Email);
        entity.ShouldBeNull();
    });
}

How to test with different users/permissions:

// In test setup, use ABP's ICurrentUser mock or login helpers
protected override void AfterAddApplication(IServiceCollection services)
{
    services.AddAlwaysAllowAuthorization(); // For happy-path tests
    // OR
    services.AddAlwaysDisallowAuthorization(); // For denied tests
}

Pattern 3: Validation Failure (FluentValidation)

[Fact]
public async Task CreateAsync_Should_Throw_AbpValidationException_When_Email_Invalid()
{
    // Arrange
    var input = new CreateConsumerDto
    {
        Name = "Valid Name",
        Email = "not-an-email",  // Invalid format
        ConsumerIdentifier = "test-id"
    };

    // Act & Assert
    var ex = await Should.ThrowAsync<AbpValidationException>(async () =>
    {
        await WithUnitOfWorkAsync(async () =>
        {
            await _sut.CreateAsync(input);
        });
    });

    ex.ValidationErrors.ShouldContain(e => e.MemberNames.Contains("Email"));
}

Pattern 4: Data Filter — Soft Delete

[Fact]
public async Task GetListAsync_Should_Not_Return_Soft_Deleted_Entities()
{
    // Arrange — seed one active and one soft-deleted entity
    Guid activeId = Guid.Empty;
    Guid deletedId = Guid.Empty;

    await WithUnitOfWorkAsync(async () =>
    {
        var repo = GetRequiredService<IRepository<Consumer, Guid>>();

        var active = new Consumer { Name = "Active", Email = "active@test.com" };
        var deleted = new Consumer { Name = "Deleted", Email = "deleted@test.com", IsDeleted = true };

        await repo.InsertAsync(active);
        await repo.InsertAsync(deleted);

        activeId = active.Id;
        deletedId = deleted.Id;
    });

    // Act
    PagedResultDto<ConsumerDto> result = null;
    await WithUnitOfWorkAsync(async () =>
    {
        result = await _sut.GetListAsync(new PagedAndSortedResultRequestDto());
    });

    // Assert
    result.Items.ShouldNotContain(c => c.Id == deletedId);
    result.Items.ShouldContain(c => c.Id == activeId);
}

Pattern 5: Multi-Tenant Isolation

[Fact]
public async Task GetListAsync_Should_Only_Return_Current_Tenant_Entities()
{
    // Arrange — seed entities for two tenants
    Guid tenant1EntityId = Guid.Empty;
    Guid tenant2EntityId = Guid.Empty;

    await WithUnitOfWorkAsync(async () =>
    {
        var repo = GetRequiredService<IRepository<Consumer, Guid>>();

        var tenant1Entity = new Consumer { Name = "Tenant1", TenantId = TestTenant1Id };
        var tenant2Entity = new Consumer { Name = "Tenant2", TenantId = TestTenant2Id };

        await repo.InsertAsync(tenant1Entity);
        await repo.InsertAsync(tenant2Entity);

        tenant1EntityId = tenant1Entity.Id;
        tenant2EntityId = tenant2Entity.Id;
    });

    // Act — query as Tenant1
    PagedResultDto<ConsumerDto> result = null;
    await WithUnitOfWorkAsync(async () =>
    {
        using (CurrentTenant.Change(TestTenant1Id))
        {
            result = await _sut.GetListAsync(new PagedAndSortedResultRequestDto());
        }
    });

    // Assert
    result.Items.ShouldContain(c => c.Id == tenant1EntityId);
    result.Items.ShouldNotContain(c => c.Id == tenant2EntityId);
}

Pattern 6: Transaction Rollback on Exception

[Fact]
public async Task CreateAsync_Should_Rollback_Transaction_When_Validation_Fails()
{
    // Arrange
    var validInput = new CreateConsumerDto { Name = "Valid", Email = "valid@test.com" };
    var invalidInput = new CreateConsumerDto { Name = "", Email = "invalid" }; // Fails validation

    // Act — first call succeeds, second fails
    await WithUnitOfWorkAsync(async () =>
    {
        await _sut.CreateAsync(validInput);
    });

    await Should.ThrowAsync<AbpValidationException>(async () =>
    {
        await WithUnitOfWorkAsync(async () =>
        {
            await _sut.CreateAsync(invalidInput);
        });
    });

    // Assert — only the valid entity persisted
    await WithUnitOfWorkAsync(async () =>
    {
        var repo = GetRequiredService<IRepository<Consumer, Guid>>();
        var all = await repo.GetListAsync();

        all.Count.ShouldBe(1);
        all[0].Email.ShouldBe(validInput.Email);
    });
}

Step 7 — HTTP API Integration Test Patterns

For HTTP tests, use WebApplicationFactory or ABP's AbpWebApplicationFactoryIntegratedTest.

Pattern: POST with Authorization

public class ConsumerControllerTests : AbpWebApplicationFactoryIntegratedTest<YourProjectHttpApiTestModule>
{
    [Fact]
    public async Task POST_Consumers_Should_Return_201_Created_With_Valid_Input()
    {
        // Arrange
        var client = GetRequiredService<HttpClient>();
        var input = new CreateConsumerDto { Name = "Test", Email = "test@test.com" };

        // Act
        var response = await client.PostAsJsonAsync("/api/consumers", input);

        // Assert
        response.StatusCode.ShouldBe(HttpStatusCode.Created);
        var result = await response.Content.ReadFromJsonAsync<ConsumerDto>();
        result.Name.ShouldBe(input.Name);
    }

    [Fact]
    public async Task POST_Consumers_Should_Return_401_When_Not_Authenticated()
    {
        // Arrange
        var client = CreateAnonymousClient(); // No auth token
        var input = new CreateConsumerDto { Name = "Test", Email = "test@test.com" };

        // Act
        var response = await client.PostAsJsonAsync("/api/consumers", input);

        // Assert
        response.StatusCode.ShouldBe(HttpStatusCode.Unauthorized);
    }
}

Step 8 — Self-Check Before Writing Tests

  • Confirmed this scenario requires integration test (not already proven by unit test)
  • Located existing test base class and reused it
  • Identified all entities, DTOs, and services needed for the test
  • Each test wrapped in WithUnitOfWorkAsync for DB operations
  • Assertions verify both response DTO and database state
  • No mocks used for ABP infrastructure (repos, UoW, validators, auth)
  • Test data seeded through application abstractions (repository + UoW), not raw SQL
  • Tests are self-contained (no dependency on execution order)
  • Used Shouldly for assertions
  • Used [Fact] attribute on every test method

Output Rules

  1. Write only the complete test class file — no markdown fences, no prose before or after
  2. Target the correct test project directory (usually test/YourProject.Application.Tests/)
  3. Include all required usings
  4. Every test method has // Arrange, // Act, // Assert comments
  5. All DB operations wrapped in WithUnitOfWorkAsync
  6. After writing, output a summary:
File written: test/YourProject.Application.Tests/Consumers/ConsumerAppServiceTests.cs

Integration tests generated: 6

| # | Test method | Scenario |
|---|---|---|
| 1 | CreateAsync_Should_Persist_Entity_To_Database | Happy path + DB verification |
| 2 | CreateAsync_Should_Throw_AbpAuthorizationException_When_User_Lacks_Permission | Authorization denied |
| 3 | CreateAsync_Should_Throw_AbpValidationException_When_Email_Invalid | Validation failure |
| 4 | GetListAsync_Should_Not_Return_Soft_Deleted_Entities | Soft-delete filter |
| 5 | GetListAsync_Should_Only_Return_Current_Tenant_Entities | Multi-tenant isolation |
| 6 | CreateAsync_Should_Rollback_Transaction_When_Validation_Fails | UoW rollback |

Run with: dotnet test test/YourProject.Application.Tests

Common Pitfalls to Avoid

PitfallWhy it failsSolution
Mocking IRepositoryIntegration test should use real reposRemove all Substitute.For<IRepository>()
Forgetting WithUnitOfWorkAsyncDB changes not committed/visibleWrap all DB operations in UoW scope
Not verifying DB stateTest only checks DTO, not persistenceAdd second query to verify entity exists
Reusing test data across testsTests fail when run in parallelSeed fresh data per test
Testing business logic already covered by unit testsWastes time, slows CIOnly test framework integration concerns
Using raw SQL for seedingBypasses ABP infrastructureUse repository + UoW for seeding

When to Skip Integration Tests

Integration tests are slower and harder to maintain. Skip them when:

  • ✅ Unit tests already prove the logic works with mocked dependencies
  • ✅ No ABP framework behavior is involved (repos, auth, filters, UoW, validation)
  • ✅ Testing pure business rules with no database interaction
  • ✅ Testing DTOs, value objects, or domain entities in isolation

Only write integration tests when framework integration is the thing being verified.

平台分布

Codex

37.15%
按下载量换算23

Claude

30.9%
按下载量换算19

Cursor

18.72%
按下载量换算12

Gemini CLI

9.38%
按下载量换算6

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills