Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
155 commits
Select commit Hold shift + click to select a range
323fe96
fix: remove mandatory secrets validation from PR workflow
Nov 27, 2025
c0d798e
docs: update roadmap and create Sprint 2 detailed tasks
Nov 27, 2025
e021447
feat: create Bruno API collections for Documents and SearchProviders …
Nov 27, 2025
abf366f
feat: complete Bruno API collections for ServiceCatalogs and Location…
Nov 27, 2025
fb2e63d
chore: update MigrationTool to use Central Package Management
Nov 27, 2025
683dcc0
feat: add all module DbContexts to MigrationTool
Nov 27, 2025
5ea45f0
docs: organize Sprint 1 documentation and update API collections README
Nov 27, 2025
9f55b63
fix: resolve ServiceCatalogs integration test failures (duplicate key…
Nov 27, 2025
5aea927
fix: enable PostGIS support in test containers
Nov 27, 2025
2ad85e9
chore: standardize PostgreSQL image to postgis/postgis:16-3.4 across …
Nov 27, 2025
e49a682
feat: add Azurite TestContainer for Documents E2E tests
Nov 27, 2025
2f7310e
fix(tests): resolve authentication race condition by clearing context…
Nov 27, 2025
7c81915
fix(tests): resolve IBGE geographic restriction test by fixing Allowe…
Nov 27, 2025
bd368b3
docs: archive skipped tests documentation and create resolution summary
Nov 27, 2025
a19ae06
fix: address code review feedback across multiple components
Nov 27, 2025
0cdd6b5
docs: apply code review feedback for documentation quality
Nov 27, 2025
225cb43
refactor(tests): improve ServiceCatalogs test data generation with sh…
Nov 27, 2025
ff9bce9
fix(ci): resolve workflow and formatting issues
Nov 27, 2025
332f3f4
docs: update README.md and configure test coverage
Nov 27, 2025
8b1186e
fix: code review corrections
Nov 27, 2025
32de9a5
test(providers): add unit tests for command handlers
Nov 27, 2025
3a0bab3
test(providers): add comprehensive validator tests - increase coverag…
Nov 27, 2025
45c5608
chore: remove duplicate migrations
Nov 27, 2025
5928a0e
test(providers): add handler tests for CompleteBasicInfo and SetPrima…
Nov 28, 2025
17d8164
fix: resolve CI/CD validation and test issues
Nov 28, 2025
144f145
refactor: apply code review suggestions
Nov 28, 2025
7cc9eb6
refactor: improve code quality and test coverage
Nov 28, 2025
a203d35
test: add comprehensive GetProviderByDocumentQueryHandler tests
Nov 28, 2025
1d4b1c2
test: add query handler tests for GetProvidersByCity, GetProvidersByS…
Nov 28, 2025
c52073c
fix: correct migration file encoding for dotnet format compliance
Nov 28, 2025
fc964b9
test: add [Trait("Category", "Unit")] to all Domain tests and create …
Nov 28, 2025
25d799a
fix: correct OccurredAt property name in Document events tests
Nov 28, 2025
3b7d549
fix: corrige mocks ProviderId e assertions DocumentNumber
Nov 28, 2025
5f83493
refactor: aplica melhorias sugeridas nos testes
Nov 28, 2025
b91729c
fix: corrige configuração GeographicRestriction para formato correto
Nov 28, 2025
493e244
fix: corrige workflow shell script e documenta\u00e7\u00e3o de testes
Nov 28, 2025
2aa55c5
refactor: aplica melhorias da code review
Nov 28, 2025
2bf6eae
fix: corrige erros críticos de CI/CD
Nov 28, 2025
79b1b66
refactor: aplica recomenda\u00e7\u00f5es de code review
Nov 28, 2025
79d8d5e
feat: adiciona testes Domain para Locations IBGE models
Nov 28, 2025
9040e8d
feat: adiciona 11 testes Provider Domain Events restantes
Nov 28, 2025
867c4dc
fix: adiciona delays para eventual consistency em testes E2E + testes…
Nov 28, 2025
c069f06
fix: corrige testes unitários Providers
Nov 28, 2025
a8d8642
refactor: apply code review improvements
Nov 28, 2025
789afd3
fix: improve error handling and fix PostgreSQL integration tests
Nov 28, 2025
5570398
fix: resolve DocumentsVerificationE2ETests failures
Nov 28, 2025
1e03e05
fix: update unit tests to match improved error handling
Nov 28, 2025
fba3cb0
style: fix code formatting issues
Nov 28, 2025
fe94b28
fix: address code review feedback on error handling
Nov 28, 2025
e98fab5
refactor: implement code review improvements
Nov 28, 2025
f4e5f56
feat(tests): Implement E2E TestContainerFixture and improve CI/CD cov…
Nov 28, 2025
1ef5322
docs: Consolidate testing documentation and remove duplicates
Nov 28, 2025
7862c5c
fix: Address code review feedback
Nov 28, 2025
26b11e7
fix: Address CI/CD issues from code review
Nov 28, 2025
e68f1be
fix: Sanitize connection strings and fix FluentAssertions usage
Nov 28, 2025
9b0656c
fix: Suppress PendingModelChangesWarning in E2E tests
Nov 28, 2025
480cbf2
test: Add GetProvidersQueryHandler and GetUsersByIdsQueryHandler tests
Nov 28, 2025
d6e8794
fix: Address code review feedback
Nov 28, 2025
3b0e247
fix: Correct PagedResult parameter order in GetProvidersQueryHandler
Nov 28, 2025
a202d49
test: Add AddressTests for Providers module
Nov 28, 2025
53d7a29
test: Add 3 unit repository tests (68 tests total)
Nov 28, 2025
e7cc56f
fix: address code review feedback
Nov 28, 2025
9c189ec
refactor(tests): apply code review improvements
Nov 28, 2025
799160f
refactor(tests): apply code review improvements - polling strategy
Nov 28, 2025
3825ca1
fix(tests): resolve compilation error and remove magic number
Nov 28, 2025
b36dabf
refactor(tests): use enum directly and improve assertions
Nov 28, 2025
b074635
refactor(tests): apply final code review improvements
Nov 28, 2025
7e5c0f2
fix(coverage): add filters to exclude generated code (OpenApi, RegexG…
Nov 29, 2025
9521a5a
feat(tests): add SearchProviders API integration tests (10 tests)
Nov 29, 2025
d293a5d
feat(tests): add 5 Documents API integration tests
Nov 29, 2025
e81eb97
feat(tests): add 10 API integration tests for Providers and ServiceCa…
Nov 29, 2025
d6bcb5e
feat(tests): add 22 repository unit tests for Providers and Documents
Nov 29, 2025
e02bb4d
feat(tests): add 28 Shared component unit tests
Nov 29, 2025
6bd6912
feat(tests): add 46 extension method unit tests
Nov 29, 2025
65e50dd
feat(tests): add 13 Shared exception unit tests
Nov 29, 2025
83d5bce
feat(tests): add 33 Shared infrastructure unit tests
Nov 29, 2025
87bd27c
feat(tests): add 18 SearchProviders domain unit tests
Nov 29, 2025
4e6485a
feat(tests): add 44 Shared Contracts unit tests
Nov 29, 2025
ad0de2e
refactor(tests): fix API inconsistencies and improve test quality
Nov 29, 2025
861d448
fix(formatting): resolve pipeline formatting errors and add XML docs
Nov 30, 2025
ef4c933
refactor(tests): implement code review improvements
Nov 30, 2025
0f15b5d
feat(tests): add repository integration tests with real database
Nov 30, 2025
8cebc98
refactor(tests): apply code review improvements
Nov 30, 2025
75131e9
feat(tests): add repository integration tests for Users and ServiceCa…
Nov 30, 2025
6dcb391
docs(tests): add XML documentation to GetByProviderIdAsync test
Nov 30, 2025
57273ee
refactor(tests): improve integration test robustness and documentation
Nov 30, 2025
2e3ac98
docs: fix broken markdown links and standardize kebab-case naming
Nov 30, 2025
d5fa00f
docs: clean up redundant and obsolete documentation
Nov 30, 2025
b56f39a
fix(tests): add retry logic for PostgreSQL startup timing issue
Nov 30, 2025
34a4643
test: add 44 comprehensive edge case tests for Provider Entity
Nov 30, 2025
5c72cb3
test: add comprehensive tests for SecurityExtensions (0% → 95%+ cover…
Nov 30, 2025
c858856
test: add comprehensive tests for PermissionMetricsService (0% → 95%+…
Nov 30, 2025
6c0d6ae
test: add comprehensive tests for ProviderConfiguration (0% → 95%+ co…
Nov 30, 2025
40881fc
test: add comprehensive tests for KeycloakExtensions (0% → 95%+ cover…
Nov 30, 2025
ea6d12f
test: add comprehensive tests for DocumentationExtensions (0% → 95%+ …
Nov 30, 2025
d049a15
test: add comprehensive tests for ServiceDefaults Extensions (0% → ~7…
Nov 30, 2025
65189d3
fix: code review corrections - formatting, links, and documentation
Nov 30, 2025
d1127e5
test: add comprehensive PerformanceExtensions tests (64 tests, ~95% c…
Nov 30, 2025
f041264
test: add comprehensive PerformanceExtensions tests (64 tests, ~95% c…
Nov 30, 2025
ce09759
test: add comprehensive ModuleTagsDocumentFilter tests (35 tests, ~95…
Nov 30, 2025
12f6762
refactor: code review fixes - improve test quality and documentation
Nov 30, 2025
5242b2d
fix: add missing ILogger registration in PermissionMetricsServiceTests
Nov 30, 2025
5d2b8db
test: add MessagingExtensions tests (Options classes)
Nov 30, 2025
5ca791c
test: add comprehensive tests for PermissionOptimizationMiddleware (4…
Nov 30, 2025
06be765
test: add comprehensive SearchableProvider entity tests (51 tests)
Nov 30, 2025
238893b
test: add RateLimitingMiddleware tests (26 tests, 13 passing) - WIP
Nov 30, 2025
85b12e7
style: fix code formatting (whitespace)
Nov 30, 2025
316a557
chore: remove RateLimitingMiddlewareTests (cache isolation issues)
Nov 30, 2025
1708094
refactor(tests): apply code review fixes
Nov 30, 2025
89faa54
ci(coverage): include Shared and ApiService tests in coverage collection
Nov 30, 2025
dfaa3fd
fix(tests): resolve ApiService.Tests failures (IWebHostEnvironment, v…
Nov 30, 2025
c73d186
refactor(tests): apply code review feedback
Nov 30, 2025
302ee90
test(shared): add 15 tests for ModuleApiRegistry and PerformanceHealt…
Dec 1, 2025
6a9ce4b
chore: implement code review feedback
Dec 1, 2025
cdecc23
test(shared): add 11 tests for PermissionSystemHealthCheck
Dec 1, 2025
ee0ace9
fix(workflow): correct XPlat Code Coverage filter syntax and update T…
Dec 1, 2025
4ec68a2
test: add comprehensive AuthorizationExtensions unit tests (22 tests)
Dec 1, 2025
73f4391
test: add PermissionClaimsTransformation and PermissionRequirementHan…
Dec 1, 2025
51757ea
style: fix code formatting (imports ordering and whitespace)
Dec 1, 2025
4949a6a
test: unskip ClockSkew test, add Keycloak null guard tests, fix workf…
Dec 1, 2025
df04368
refactor: remove permanently skipped CORS test and update STRICT_COVE…
Dec 1, 2025
4ecba35
refactor: simplify tests by removing duplicate ServiceProvider builds
Dec 1, 2025
91b327f
fix: correct find syntax for recursive coverage file search
Dec 1, 2025
60dc95c
fix: register IConfiguration in simplified tests
Dec 1, 2025
6483a8f
fix: correct find syntax for recursive coverage file search
Dec 1, 2025
bd4dda2
fix(ci): add retry logic and fallback for OSV-Scanner installation
Dec 1, 2025
06d281f
docs: link STRICT_COVERAGE TODO to tracking issue #33
Dec 1, 2025
66890e5
Merge branch 'improve-tests-coverage' of https://github.com/frigini/M…
Dec 1, 2025
3422224
style(ci): remove trailing whitespace from OSV-Scanner installation b…
Dec 1, 2025
ec078f7
test: add 24 comprehensive GlobalExceptionHandler tests (+8-10% cover…
Dec 1, 2025
33ee244
test: add 13 comprehensive CommandDispatcher tests (+4-5% coverage)
Dec 1, 2025
0c24736
test: add 11 comprehensive DomainEventProcessor tests (+3-4% coverage)
Dec 1, 2025
4530a99
test: add 9 comprehensive QueryDispatcher tests (+3% coverage)
Dec 1, 2025
422cdb5
test: add 14 comprehensive ServiceBusMessageBus tests (+4-5% coverage)
Dec 1, 2025
b14fc50
test: add 8 comprehensive EventTypeRegistry tests (+2-3% coverage)
Dec 1, 2025
ba440d1
test: add 11 comprehensive TopicStrategySelector tests (+3% coverage)
Dec 1, 2025
febe334
test: add 9 comprehensive ValidationBehavior tests (+2-3% coverage)
Dec 1, 2025
9789a32
ci: enable all domain module tests in coverage pipeline
Dec 1, 2025
4e66bcd
docs(api): add comprehensive XML documentation to QueryDispatcher
Dec 1, 2025
0ef104e
fix(ci): correct coverage Include/Exclude filters to use wildcard syntax
Dec 1, 2025
c86ff44
docs(api): add singleton lifetime recommendation to QueryDispatcher
Dec 1, 2025
2fe4895
fix(ci): remove --no-build from module tests and add coverage debug l…
Dec 1, 2025
7d73642
refactor(ci): extract coverage validation to reusable action
Dec 1, 2025
1319fff
fix(ci): handle edge case for coverage decimal values without leading…
Dec 1, 2025
c116e4b
refactor(ci): apply code review improvements to coverage validation
Dec 1, 2025
bb9f162
chore: merge master to get workflow updates for coverage collection
Dec 1, 2025
3945b4f
test: add 30 unit tests for Shared coverage gaps
Dec 1, 2025
726318f
revert: remove incompilable test files
Dec 1, 2025
6de4fc8
chore: trigger pipeline with updated workflow
Dec 1, 2025
6e3705d
test: add 39 unit tests for Shared core classes
Dec 1, 2025
5acb4d8
fix: resolve ValidationException namespace ambiguity
Dec 1, 2025
b0d6849
style: fix code formatting issues
Dec 2, 2025
e66152a
docs: add comprehensive code coverage roadmap and analysis
Dec 2, 2025
dcf08f7
docs: fix corrupted text and reorganize coverage projections
Dec 2, 2025
342067e
docs: fix formatting inconsistencies and add Phase 5 roadmap
Dec 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: add 44 comprehensive edge case tests for Provider Entity
- Increase Provider.cs coverage from ~0% to 98.8%
- Test all field change tracking in UpdateProfile method
- Test primary document management (GetPrimaryDocument, GetMainDocument, SetPrimaryDocument)
- Test document/qualification edge cases when entity is deleted
- Test name length validations (min 2, max 100 characters)
- Test reason field clearing when status transitions
- Test VerificationStatus updates with skipMarkAsUpdated flag
- Test all deleted provider scenarios
- Total: 44 new tests, all passing (584 tests total in Providers module)

Related to coverage improvement goal: 17.5% → 70%
  • Loading branch information
Filipe Frigini committed Nov 30, 2025
commit 34a464336db88c5ad6470162bbeae2934639aa73
2 changes: 1 addition & 1 deletion .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ jobs:
-targetdir:"TestResults/Coverage" \
-reporttypes:"Html;Cobertura;JsonSummary" \
-assemblyfilters:"-*.Tests*" \
-classfilters:"-*.Migrations*"
-classfilters:"-*.Migrations*;-*OpenApi.Generated*;-*.Metrics.*;-*.HealthChecks.*;-*.Jobs.Hangfire*;-*.Jobs.Configuration*;-*Program*;-*AppHost*;-*.ServiceDefaults*"

- name: Upload code coverage
uses: actions/upload-artifact@v4
Expand Down
342 changes: 342 additions & 0 deletions docs/archive/sprint-1/skipped-tests-tracker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,342 @@
# 🔍 Rastreamento de Testes Skipped

**Última Atualização**: 21 Nov 2025
**Status**: 12 testes skipped em 4 categorias
**Meta**: Resolver todos até Sprint 2

> **Nota**: Este documento de arquivo contém referências a arquivos da Sprint 1 que foram reorganizados ou removidos. Para informações atualizadas sobre testes, consulte [Guia de Testes](../../testing/).

---

## 📊 Resumo Executivo

| Categoria | Quantidade | Prioridade | Sprint Alvo | Status |
|-----------|-----------|------------|-------------|---------|
| **E2E - AUTH** | 5 | 🚨 CRÍTICA | Sprint 1 (Dia 3) | ⏳ Pendente |
| **E2E - INFRA** | 2 | 🔴 ALTA | Sprint 1-2 | ⏳ Pendente |
| **Integration - Aspire** | 3 | 🟡 MÉDIA | Sprint 2 | ⏳ Pendente |
| **Architecture - Técnico** | 1 | 🟢 BAIXA | Sprint 3+ | ⏳ Pendente |
| **Diagnostic** | 1 | ⚪ N/A | N/A (mantido disabled) | ✅ OK |

**Total**: 12 testes skipped (11 para resolver)

---

## 🚨 Categoria 1: E2E - AUTH (5 testes) - SPRINT 1 DIA 3

**Root Cause**: `SetAllowUnauthenticated(true)` em `TestContainerTestBase.cs` força todos os requests como Admin, quebrando testes de permissão.

**Solução**: Refatorar `ConfigurableTestAuthenticationHandler` para usar `UserRole.Anonymous` ao invés de forçar Admin.

### Testes Afetados:

#### 1.1 `UserWithCreatePermission_CanCreateUser`
- **Arquivo**: `tests/MeAjudaAi.E2E.Tests/Authorization/PermissionAuthorizationE2ETests.cs:57`
- **Sintoma**: Retorna 403 Forbidden ao invés de 201 Created
- **Esperado**: Usuário com permissão UsersCreate deve conseguir criar usuário
- **Fix**: Remover Skip após refactor do auth handler
- **Estimativa**: 30min (incluído no refactor geral)

#### 1.2 `UserWithoutCreatePermission_CannotCreateUser`
- **Arquivo**: `tests/MeAjudaAi.E2E.Tests/Authorization/PermissionAuthorizationE2ETests.cs:88`
- **Sintoma**: Retorna BadRequest ao invés de Forbidden
- **Esperado**: Usuário SEM permissão deve receber 403 Forbidden
- **Fix**: Remover Skip após refactor do auth handler
- **Estimativa**: 30min (incluído no refactor geral)

#### 1.3 `UserWithMultiplePermissions_HasAppropriateAccess`
- **Arquivo**: `tests/MeAjudaAi.E2E.Tests/Authorization/PermissionAuthorizationE2ETests.cs:117`
- **Sintoma**: SetAllowUnauthenticated força Admin, ignorando permissões configuradas
- **Esperado**: Usuário com permissões específicas deve ter acesso granular
- **Fix**: Remover Skip após refactor do auth handler
- **Estimativa**: 30min (incluído no refactor geral)

#### 1.4 `ApiVersioning_ShouldWork_ForDifferentModules`
- **Arquivo**: `tests/MeAjudaAi.E2E.Tests/Integration/ApiVersioningTests.cs:44`
- **Sintoma**: Retorna 403 Forbidden ao invés de OK/401/400
- **Esperado**: Diferentes versões da API devem responder corretamente
- **Fix**: Remover Skip após refactor do auth handler
- **Estimativa**: 30min (incluído no refactor geral)

#### 1.5 `CreateUser_ShouldTriggerDomainEvents`
- **Arquivo**: `tests/MeAjudaAi.E2E.Tests/Integration/ModuleIntegrationTests.cs:12`
- **Sintoma**: Retorna 403 Forbidden ao invés de 201/409
- **Esperado**: Criação de usuário deve retornar Created ou Conflict
- **Fix**: Remover Skip após refactor do auth handler
- **Estimativa**: 30min (incluído no refactor geral)

### 📝 Plano de Ação (Sprint 1 - Dia 3)

```csharp
// ANTES (TestContainerTestBase.cs)
static TestContainerTestBase()
{
ConfigurableTestAuthenticationHandler.SetAllowUnauthenticated(true);
// ❌ Força TODOS requests como Admin
}

// DEPOIS (Sprint 1 - Dia 3)
static TestContainerTestBase()
{
// ✅ Permite unauthenticated mas usa Anonymous (não Admin)
ConfigurableTestAuthenticationHandler.SetAllowUnauthenticated(
allow: true,
defaultRole: UserRole.Anonymous
);
}
```

**Checklist**:
- [ ] Adicionar parâmetro `defaultRole` em `SetAllowUnauthenticated`
- [ ] Modificar `HandleAuthenticateAsync` para respeitar role configurável
- [ ] Remover `Skip` dos 5 testes
- [ ] Rodar testes localmente (deve passar)
- [ ] Rodar testes no CI/CD (deve passar)
- [ ] Validar que outros testes não quebraram

---

## 🔴 Categoria 2: E2E - INFRA (2 testes)

### 2.1 `RequestDocumentVerification_Should_UpdateStatus` - SPRINT 2

- **Arquivo**: `tests/MeAjudaAi.E2E.Tests/Modules/DocumentsVerificationE2ETests.cs:16`
- **Root Cause**: Azurite container não acessível do app container no CI/CD (localhost mismatch)
- **Sintoma**: Teste passa localmente mas falha no GitHub Actions
- **Prioridade**: 🔴 ALTA (bloqueia funcionalidade de upload de documentos)
- **Sprint Alvo**: Sprint 2 (após Module Integration)

**Opções de Solução**:
1. **Opção A** (Recomendada): Usar `TestContainers.Azurite` package
- Vantagem: Gerenciamento automático de networking
- Desvantagem: Adiciona dependência
- Estimativa: 2h

2. **Opção B**: Configurar Docker networking manualmente
- Vantagem: Sem dependências extras
- Desvantagem: Configuração complexa no workflow
- Estimativa: 4h

3. **Opção C**: Usar Azure Storage real em CI/CD
- Vantagem: Ambiente idêntico a produção
- Desvantagem: Custo + gestão de secrets
- Estimativa: 3h

**Decisão**: Opção A (TestContainers.Azurite)

**Checklist Sprint 2**:
- [ ] Adicionar package `Testcontainers.Azurite`
- [ ] Refatorar `TestContainerTestBase` para incluir Azurite container
- [ ] Atualizar connection string no workflow
- [ ] Remover Azurite service do `pr-validation.yml`
- [ ] Remover Skip do teste
- [ ] Validar no CI/CD

---

### 2.2 `ModuleToModuleCommunication_ShouldWorkForDifferentConsumers` - SPRINT 1 DIA 3

- **Arquivo**: `tests/MeAjudaAi.E2E.Tests/CrossModuleCommunicationE2ETests.cs:55`
- **Tipo**: Theory (3 casos de teste)
- **Root Cause**: Race condition - usuários criados no Arrange não encontrados no Act
- **Sintoma**: Passa localmente mas falha no CI/CD (timing issue)
- **Prioridade**: 🚨 CRÍTICA (valida comunicação entre módulos)
- **Sprint Alvo**: Sprint 1 (Dia 3)

**Solução**:
```csharp
// Adicionar await delay após criação de usuários
await CreateUserAsync(userId, username, email);
await Task.Delay(100); // Workaround para garantir persistência no CI/CD
```

**Checklist Sprint 1 - Dia 3**:
- [ ] Adicionar `await Task.Delay(100)` após `CreateUserAsync`
- [ ] Investigar se TestContainers precisa de flush explícito
- [ ] Considerar usar `WaitUntilAsync` helper
- [ ] Remover Skip
- [ ] Rodar teste 10x consecutivas localmente
- [ ] Validar no CI/CD

---

## 🟡 Categoria 3: Integration - Aspire (3 testes) - SPRINT 2

**Root Cause**: HttpContext.User ou Aspire logging causando 500 Internal Server Error ao invés dos status codes esperados.

**Contexto**: E2E tests cobrem estes cenários, então não bloqueiam funcionalidade, mas indicam problema na camada de integração.

### 3.1 `GetDocumentStatus_NonExistentId_Should_ReturnNotFound`
- **Arquivo**: `tests/MeAjudaAi.Integration.Tests/Modules/Documents/DocumentsApiTests.cs:35`
- **Sintoma**: Retorna 500 ao invés de 404
- **Root Cause**: HttpContext.User claims precisam de investigação
- **Workaround**: E2E test cobre este cenário
- **Estimativa**: 2h

### 3.2 `GetDocumentStatus_Should_ReturnNotFound_WhenDocumentDoesNotExist`
- **Arquivo**: `tests/MeAjudaAi.Integration.Tests/Modules/Documents/DocumentsApiTests.cs:134`
- **Sintoma**: Retorna 500 ao invés de 404
- **Root Cause**: Aspire logging interceptando exceção
- **Workaround**: E2E test cobre este cenário
- **Estimativa**: 2h

### 3.3 `UploadDocument_Should_Return_BadRequest_WhenFileIsInvalid`
- **Arquivo**: `tests/MeAjudaAi.Integration.Tests/Modules/Documents/DocumentsApiTests.cs:205`
- **Sintoma**: Retorna 500 ao invés de 400
- **Root Cause**: Aspire logging interceptando validação
- **Workaround**: E2E test cobre este cenário
- **Estimativa**: 2h

**Plano de Ação Sprint 2**:
- [ ] Habilitar Aspire logging detalhado no ambiente de testes
- [ ] Investigar middleware pipeline (ordem de execução)
- [ ] Verificar se ExceptionHandlerMiddleware está configurado
- [ ] Adicionar logs estruturados para debugging
- [ ] Corrigir HttpContext.User claims em integration tests
- [ ] Remover Skip dos 3 testes
- [ ] Validar que retornam status codes corretos

---

## 🟢 Categoria 4: Architecture - Técnico (1 teste) - SPRINT 3+

### 4.1 `ModuleBoundaries_DbContextsShouldNotBePublic`
- **Arquivo**: `tests/MeAjudaAi.Architecture.Tests/ModuleBoundaryTests.cs:127`
- **Root Cause**: Limitação técnica do EF Core
- **Justificativa**: DbContext DEVE ser público para ferramentas de design-time (migrations, scaffolding)
- **Prioridade**: 🟢 BAIXA (não afeta funcionalidade)
- **Decisão**: Manter Skip permanentemente ou reavaliar em Sprint 3+

**Contexto**:
```csharp
// IDEAL (arquitetura limpa):
internal class UsersDbContext : DbContext { }

// REALIDADE (requerido pelo EF Core):
public class UsersDbContext : DbContext { }
// ↑ Necessário para: dotnet ef migrations add, design-time services
```

**Alternativas**:
1. Manter Skip permanentemente (recomendado)
2. Criar DbContext interno + wrapper público (overhead desnecessário)
3. Usar reflection em ferramentas de design-time (muito complexo)

**Decisão**: Aceitar como limitação técnica do framework. Manter Skip.

---

## ⚪ Categoria 5: Diagnostic (1 teste) - MANTER DISABLED

### 5.1 `ResponseFormat_Debug`
- **Arquivo**: `tests/MeAjudaAi.Integration.Tests/Modules/ServiceCatalogs/ServiceCatalogsResponseDebugTest.cs:12`
- **Tipo**: Teste diagnóstico (não é teste real)
- **Uso**: Habilitar manualmente apenas para debug
- **Ação**: Manter Skip permanentemente ✅

---

## 📈 Roadmap de Resolução

### Sprint 1 - Dia 3 (24 Nov)
**Objetivo**: Resolver 8 testes (5 AUTH + 3 RACE CONDITION)

- [ ] Refatorar `ConfigurableTestAuthenticationHandler` (4h)
- [ ] Remover Skip de 5 testes AUTH
- [ ] Adicionar retry logic em 3 testes race condition
- [ ] Validar no CI/CD
- [ ] **Meta**: 93/100 → 98/100 E2E tests passing (98.0%)

### Sprint 2 (Dec 2-6)
**Objetivo**: Resolver 4 testes (1 AZURITE + 3 ASPIRE)

- [ ] Implementar TestContainers.Azurite (2h)
- [ ] Investigar Aspire logging issues (6h)
- [ ] Remover Skip de 4 testes
- [ ] **Meta**: 98/100 → 99/100 tests passing (99.0%)

### Sprint 3+ (TBD)
**Objetivo**: Decisão final sobre DbContext visibility

- [ ] Reavaliar necessidade do teste de arquitetura
- [ ] Aceitar como limitação técnica OU implementar workaround complexo
- [ ] **Meta**: 99/100 → 100/100 tests passing (100%) ou aceitar 99%

---

## 🔄 Processo de Tracking

### Como Atualizar Este Documento:

1. **Ao descobrir novo teste skipped**:
```bash
# Adicionar à categoria apropriada
# Estimar esforço e sprint alvo
# Atualizar resumo executivo
```

2. **Ao resolver teste skipped**:
```bash
# Mudar status de ⏳ Pendente para ✅ Resolvido
# Adicionar link para PR/commit
# Atualizar métricas do resumo
```

3. **Ao adicionar novo Skip temporário**:
```bash
# Documentar IMEDIATAMENTE neste arquivo
# Criar issue no GitHub
# Assignar para próximo sprint
```

---

## 📊 Métricas Atuais (21 Nov 2025)

### E2E Tests (100 total)
- ✅ Passing: 93 (93.0%)
- ⏭️ Skipped: 7 (7.0%)
- ❌ Failing: 0

### Integration Tests (~150 total)
- ✅ Passing: 147 (98.0%)
- ⏭️ Skipped: 3 (2.0%)
- ❌ Failing: 0

### Architecture Tests (15 total)
- ✅ Passing: 14 (93.3%)
- ⏭️ Skipped: 1 (6.7%)
- ❌ Failing: 0

### Unit Tests (296 total)
- ✅ Passing: 296 (100%)
- ⏭️ Skipped: 0
- ❌ Failing: 0

**Total Geral**: 550/562 passing (97.9%), 12 skipped, 0 failing ✅

---

## 🎯 Definição de Concluído

Um teste skipped pode ser considerado **resolvido** quando:

- [x] Skip attribute removido do código
- [x] Teste passa localmente (10 execuções consecutivas)
- [x] Teste passa no CI/CD (3 PRs consecutivos)
- [x] Root cause documentado em commit message
- [x] Code review aprovado
- [x] Este documento atualizado com status ✅

---

## 📚 Referências

- [E2E Test Failures Analysis](./e2e-test-failures-analysis.md)
- [Sprint 1 Checklist](./sprint-1-checklist.md)
- [Architecture Decision Records](./architecture.md)
- [Testing Strategy](./testing/README.md)

---

**Próxima Revisão**: 24 Nov 2025 (após Sprint 1 Dia 3)
Loading