"Testing is not about finding bugs, it's about preventing them."
This index provides a comprehensive navigation guide to all testing documentation for the CleanArchitecture.ApiTemplate project, covering API endpoint testing, clean architecture testing strategies, and best practices.
Complete guide for testing all API endpoints in CleanArchitecture.ApiTemplate.
Contents:
- ? Running the application (local & Docker)
- ? Testing with Swagger UI
- ? Testing with Postman
- ? Complete endpoint reference (10 endpoints)
- ? Troubleshooting tips for each endpoint
- ? Quick reference tables
- ? cURL command examples
- ? Advanced testing scenarios (CORS, rate limiting, error handling)
Use this guide when:
- Testing individual API endpoints
- Setting up Postman collections
- Troubleshooting endpoint issues
- Learning how to test authentication flows
- Testing token blacklisting
Comprehensive testing strategy for Clean Architecture implementation.
Contents:
- ? Testing pyramid strategy
- ? Domain layer unit tests
- ? Application layer unit tests
- ? Infrastructure integration tests
- ? Web/API functional tests
- ? Architecture tests (DDD rules)
- ? Aggregate root architecture tests
- ? Required testing packages
- ? CI/CD integration examples
Use this guide when:
- Writing unit tests for domain entities
- Testing CQRS handlers
- Creating integration tests
- Enforcing architectural rules
- Setting up test projects
- Implementing DDD patterns
Step-by-step guide for testing API security and authentication.
Contents:
- ? JWT authentication testing workflows
- ? CQRS login/logout implementation testing
- ? Token blacklisting verification
- ? Swagger UI testing procedures
- ? cURL command examples for all auth endpoints
- ? Role-based authorization testing (User vs Admin)
- ? Rate limiting verification
- ? Admin monitoring endpoints testing
- ? Complete troubleshooting guide
- ? Interview talking points
Use this guide when:
- Testing JWT authentication endpoints
- Verifying secure login/logout flows
- Testing token blacklisting functionality
- Learning CQRS authentication patterns
- Testing role-based access control
- Troubleshooting authentication issues
- Preparing for security-focused interviews
| Test Type | Guide | Section |
|---|---|---|
| API Endpoint Testing | API_ENDPOINT_TESTING_GUIDE.md | All sections |
| Authentication Testing | TEST_AUTHENTICATION_GUIDE.md | All sections ? |
| JWT Login/Logout | TEST_AUTHENTICATION_GUIDE.md | Steps 4 & 7 ? |
| Token Blacklisting | TEST_AUTHENTICATION_GUIDE.md | Step 7 ? |
| Unit Tests (Domain) | CLEAN_ARCHITECTURE_TESTING_STRATEGY.md | Section 4 |
| Unit Tests (Application) | CLEAN_ARCHITECTURE_TESTING_STRATEGY.md | Section 5 |
| Integration Tests | CLEAN_ARCHITECTURE_TESTING_STRATEGY.md | Section 6 |
| Functional Tests | CLEAN_ARCHITECTURE_TESTING_STRATEGY.md | Section 7 |
| Architecture Tests | CLEAN_ARCHITECTURE_TESTING_STRATEGY.md | Section 8 |
| Swagger Testing | API_ENDPOINT_TESTING_GUIDE.md | Section 3 |
| Postman Testing | API_ENDPOINT_TESTING_GUIDE.md | Section 4 |
| Troubleshooting | API_ENDPOINT_TESTING_GUIDE.md | Section 5 (Endpoint Reference) |
- Read API_ENDPOINT_TESTING_GUIDE.md
- Start application (local or Docker)
- Open Swagger UI:
https://localhost:7178/swagger - Follow the testing workflows
- Read TEST_AUTHENTICATION_GUIDE.md
- Run the application:
dotnet run - Open Swagger UI:
https://localhost:7178/swagger - Follow Steps 1-8 for complete authentication testing
- Test JWT login, logout, and token blacklisting
- Verify role-based access control (User vs Admin)
- Read CLEAN_ARCHITECTURE_TESTING_STRATEGY.md
- Review testing pyramid (Section 2)
- Set up test projects (Section 3)
- Write tests following examples
- 3 Authentication endpoints
- 4 Sample data endpoints
- 3 Token blacklist endpoints
- ? Domain Unit Tests
- ? Application Unit Tests
- ? Infrastructure Integration Tests
- ? Web/API Functional Tests
- ? Architecture Tests
- ? Aggregate Root Tests
- ? Authentication & Authorization Tests ? NEW
- ? JWT Token Blacklisting Tests ? NEW
| Tool | Purpose | Documentation |
|---|---|---|
| xUnit | Test framework | CLEAN_ARCHITECTURE_TESTING_STRATEGY.md |
| FluentAssertions | Readable assertions | CLEAN_ARCHITECTURE_TESTING_STRATEGY.md |
| Moq | Mocking framework | CLEAN_ARCHITECTURE_TESTING_STRATEGY.md |
| Swagger UI | Interactive API testing | API_ENDPOINT_TESTING_GUIDE.md |
| Postman | API testing & automation | API_ENDPOINT_TESTING_GUIDE.md |
| cURL | Command-line API testing | TEST_AUTHENTICATION_GUIDE.md ? |
| NetArchTest | Architecture rules | CLEAN_ARCHITECTURE_TESTING_STRATEGY.md |
| WebApplicationFactory | Functional testing | CLEAN_ARCHITECTURE_TESTING_STRATEGY.md |
| Apache Bench | Performance testing | API_ENDPOINT_TESTING_GUIDE.md |
- Authentication & Authorization Hub - ?? START HERE - Complete authentication documentation ? NEW
- TEST_AUTHENTICATION_GUIDE.md - Step-by-step authentication testing
- JWT_AUTHENTICATION_CQRS_ARCHITECTURE.md - CQRS authentication architecture
- API-SECURITY-IMPLEMENTATION-GUIDE.md - Security implementation details
- Architecture Patterns - Understanding Clean Architecture & DDD
- Clean Architecture Hub - Complete architecture documentation
- API Design Guide - API design principles
- API Contracts Examples - Request/response examples
- xUnit Documentation
- FluentAssertions
- Moq Documentation
- Postman Documentation
- NetArchTest
- JWT.io - JWT token decoder
- ? Always test both success and failure scenarios
- ? Verify HTTP status codes match expectations
- ? Test authentication and authorization separately
- ? Use automated tools (Postman collections) for regression testing
- ? Test rate limiting and CORS policies
- ? Test token generation and validation
- ? Verify token expiration behavior
- ? Test logout and token blacklisting
- ? Verify role-based access control
- ? Test with expired/invalid/malformed tokens
- ? Test business logic in isolation
- ? Mock external dependencies
- ? Follow AAA pattern (Arrange, Act, Assert)
- ? Use meaningful test names
- ? Keep tests fast and independent
Need Help?
- ?? Review guides in this folder
- ?? GitHub Issues
- ?? Email: softevolutionsl@gmail.com
- ?? GitHub: @dariemcarlosdev
Last Updated: January 2025
Maintainer: Dariemcarlos
Project: CleanArchitecture.ApiTemplate
Happy Testing! ??