Writes ABP Angular component/service unit tests using ABP testing modules (CoreTestingModule, ThemeSharedTestingModule) on Vitest or Jest. Includes body-level UI cleanup helpers.
Ships in abp-testing. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
ABP ships Angular testing modules that stand in a config-provider-only version of the framework so a TestBed boots without a real backend. Use them instead of hand-wiring RestService/PermissionService fakes.
TestBed.Import CoreTestingModule.withConfig() (from @abp/ng.core/testing) — it swaps in a CORE_OPTIONS with skipGetAppConfiguration: true and mock PermissionService/RestService, so nothing calls a backend. Add ThemeSharedTestingModule.withConfig() (from @abp/ng.theme.shared/testing) when the component uses theme-shared pieces (validation, toasts). Standalone components go in imports.
import { CoreTestingModule } from '@abp/ng.core/testing';
import { ThemeSharedTestingModule } from '@abp/ng.theme.shared/testing';
import { AuthService } from '@abp/ng.core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { vi } from 'vitest';
import { BooksComponent } from './books.component';
describe('BooksComponent', () => {
let fixture: ComponentFixture<BooksComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
CoreTestingModule.withConfig(),
ThemeSharedTestingModule.withConfig(),
BooksComponent, // standalone -> imports, not declarations
],
providers: [
{ provide: AuthService, useValue: { isAuthenticated: false, navigateToLogin: vi.fn() } },
],
}).compileComponents();
});
it('creates', () => {
fixture = TestBed.createComponent(BooksComponent);
fixture.detectChanges();
expect(fixture.componentInstance).toBeTruthy();
});
});
withConfig() accepts overrides (baseHref, routes, listQueryDebounceTime, …); both testing modules also import RouterTestingModule, so routed components work. Add ThemeBasicTestingModule.withConfig() (from @abp/ng.theme.basic/testing, no arguments) only if the app uses @abp/ng.theme.basic.
clearPage and waitModals, toasts, and confirmation dialogs render into document.body, which jsdom doesn't tear down between tests. Both helpers come from @abp/ng.core/testing:
clearPage(fixture) — removes leftover abp-* / ngb-* elements from the body. Call it in afterEach for components that open dialogs.wait(fixture, timeout = 0) — runs detectChanges() then resolves a setTimeout, to let body-level UI settle before asserting. Keep timeout at 0.The current generated app template runs on Vitest + jsdom (test builder @angular/build:unit-test), and there's no Karma. But don't hard-code Vitest: some @abp/ng.* packages (e.g. cms-kit) still use an Nx Jest target, and existing apps may keep Jest. First read the target project's project.json / angular.json / package.json scripts to see which runner it uses, then match its API and mock syntax (vi.* for Vitest vs jest.* for Jest). Framework libraries additionally use @ngneat/spectator; app code uses plain TestBed.
ng test / the app's Vitest target) and confirm the component instantiates with no real HTTP calls.clearPage leaves the body empty for the next test.declarations. Standalone components go in imports.clearPage. A modal from one test leaks into the next as stray abp-* body nodes and flakes assertions.ThemeBasicTestingModule unconditionally. Only needed if the app actually uses @abp/ng.theme.basic; unlike the other two, its withConfig() takes no arguments.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
3 skills in this plugin
/test-abp-applicationsWrite or fix integration tests for an ABP application against the generated *TestBase — resolving services, controlling the unit of work, seeding data, faking the current user/tenant, exercising the real `[Authorize]` pipeline, and proving transaction rollback across EF Core and MongoDB. USE FOR: the `AbpIntegratedTest`/`*TestBase` chain, per-provider test classes, `GetRequiredService`, `WithUnitOfWorkAsync`/`IUnitOfWorkManager.Begin`, `*TestDataSeedContributor`, `ICurrentPrincipalAccessor.Change`, undoing `AddAlwaysAllowAuthorization` (DENY) / `AddAlwaysDisableUnitOfWorkTransaction` (EF rollback), `ICurrentTenant.Change`, SQLite/MongoSandbox differences. DO NOT USE FOR: production unit-of-work config (use manage-units-of-work); production data seeding (use seed-application-data); production multi-tenant setup (use configure-multi-tenancy); production permission definitions (use permissions-and-authorization); Angular component tests (use test-angular-ui); MVC/Razor page tests (use test-mvc-razor-ui).
/test-mvc-razor-uiWrite ABP MVC/Razor integration tests that drive real HTTP against the app through AbpWebApplicationFactoryIntegratedTest. USE FOR: subclassing AbpWebApplicationFactoryIntegratedTest with the SUT Program type (not a module); the Client (AllowAutoRedirect is false, so unauthenticated requests return 302); GetRequiredService/GetService/GetUrl; the per-solution GetResponseAsStringAsync/GetResponseAsObjectAsync/GetResponseAsync helpers (Shouldly-based, copied into the WebTestBase — not shipped in any NuGet package); the web test module (DependsOn AbpAspNetCoreTestBaseModule plus the SUT web module, the CompiledRazorAssemblyPart registration, and the OpenIddict dev certificate); and faking a logged-in user with the FakeAuthentication scheme plus FakeUserClaims pushing an AbpClaimTypes.UserId claim. DO NOT USE FOR: application-service/repository integration tests (test-abp-applications); Angular component tests (test-angular-ui); production hosting/middleware configuration (configure-production-hosting).
/abp-testing:test-angular-uifrom abp-testing
npx claudepluginhub abpframework/abp-skills --plugin abp-testingOther plugins' skills for the same job