Skip to content

Latest commit

 

History

History
233 lines (182 loc) · 8.87 KB

File metadata and controls

233 lines (182 loc) · 8.87 KB

Testing Documentation Index - CleanArchitecture.ApiTemplate

"Testing is not about finding bugs, it's about preventing them."

?? Overview

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.


?? Documentation Files

1. API_ENDPOINT_TESTING_GUIDE.md

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

2. CLEAN_ARCHITECTURE_TESTING_STRATEGY.md

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

3. TEST_AUTHENTICATION_GUIDE.md ? NEW

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

?? Quick Navigation

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)

?? Getting Started

For API Testing:

  1. Read API_ENDPOINT_TESTING_GUIDE.md
  2. Start application (local or Docker)
  3. Open Swagger UI: https://localhost:7178/swagger
  4. Follow the testing workflows

For Authentication Testing: ? NEW

  1. Read TEST_AUTHENTICATION_GUIDE.md
  2. Run the application: dotnet run
  3. Open Swagger UI: https://localhost:7178/swagger
  4. Follow Steps 1-8 for complete authentication testing
  5. Test JWT login, logout, and token blacklisting
  6. Verify role-based access control (User vs Admin)

For Unit/Integration Testing:

  1. Read CLEAN_ARCHITECTURE_TESTING_STRATEGY.md
  2. Review testing pyramid (Section 2)
  3. Set up test projects (Section 3)
  4. Write tests following examples

?? Testing Coverage

API Endpoints Documented: 10/10 ?

  • 3 Authentication endpoints
  • 4 Sample data endpoints
  • 3 Token blacklist endpoints

Test Types Covered:

  • ? 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

??? Testing Tools Used

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

?? Related Documentation

Security & Authentication

Architecture & Patterns

API Design


?? External Resources


?? Testing Best Practices

API Testing

  1. ? Always test both success and failure scenarios
  2. ? Verify HTTP status codes match expectations
  3. ? Test authentication and authorization separately
  4. ? Use automated tools (Postman collections) for regression testing
  5. ? Test rate limiting and CORS policies

Authentication Testing

  1. ? Test token generation and validation
  2. ? Verify token expiration behavior
  3. ? Test logout and token blacklisting
  4. ? Verify role-based access control
  5. ? Test with expired/invalid/malformed tokens

Unit Testing

  1. ? Test business logic in isolation
  2. ? Mock external dependencies
  3. ? Follow AAA pattern (Arrange, Act, Assert)
  4. ? Use meaningful test names
  5. ? Keep tests fast and independent

?? Contact & Support

Need Help?


Last Updated: January 2025
Maintainer: Dariemcarlos
Project: CleanArchitecture.ApiTemplate


Happy Testing! ??