abp-testing

Guides ABP Framework integration testing with Shouldly assertions and mocked services.

14.4k|3.7k|Updated Dec 3, 2016
One-click install
npx skills add https://github.com/abpframework/abp --skill abp-testing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: abp-testing
Source: https://github.com/abpframework/abp/tree/main/.claude/skills/abp-testing
Command: npx skills add https://github.com/abpframework/abp --skill abp-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides clear guidance and examples for implementing effective testing strategies within ABP Framework projects, ensuring robust and maintainable code.

Core Features & Use Cases

  • Integration Testing: Demonstrates ABP's recommended approach using real services and in-memory databases.
  • Unit Testing: Shows how to test domain and application services effectively.
  • Assertion Library: Utilizes Shouldly for expressive and readable assertions.
  • Test Data Management: Covers data seeding and managing test data for consistency.
  • Authorization & Multi-Tenancy: Illustrates how to handle authorization and tenant contexts in tests.

Quick Start

Use the abp-testing skill to write an integration test for an ABP application service.

Frequently Asked Questions about abp-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write integration tests for ABP framework application services?

To write ABP framework integration tests, use real services with in-memory databases rather than mocking dependencies. This approach validates actual service behavior and is the recommended testing pattern for application services.

What is the best way to mock dependencies when unit testing ABP domain services?

The best way to mock dependencies for ABP domain service unit tests is using NSubstitute. It allows you to isolate the domain service by substituting external dependencies while testing the core business logic.

Does ABP framework testing support disabling authorization for integration tests?

Yes, ABP framework testing supports disabling authorization by using AddAlwaysAllowAuthorization. This bypasses permission checks during integration tests to focus on verifying service logic.

How do I manage test data consistency when testing ABP application services?

Manage test data consistency in ABP by implementing IDataSeedContributor for data seeding. This ensures your in-memory database is populated with predictable baseline data before tests run.

How does ABP handle testing application services with specific users and multi-tenancy?

ABP framework handles testing with specific users and multi-tenancy by configuring the test context. This ensures your application service tests execute within the correct tenant and user identity boundaries.

Can I use Shouldly for assertions in ABP framework integration tests?

Yes, you can use Shouldly for assertions in ABP framework integration tests. Shouldly provides expressive and readable assertions that make test failures easier to diagnose.