Foundgine

HomeDocumentationContributingTesting

Testing

Contents


Philosophy

Testing should mirror the architecture.

Foundation

↓

Generator

↓

Runtime

↓

SQL

↓

Transport

Every layer has its own responsibilities and should be tested independently.

Avoid relying solely on end-to-end integration tests.


Testing Pyramid

               End-to-End
            Integration Tests
             Snapshot Tests
               Unit Tests

The majority of tests should be unit tests.

Integration tests validate interactions between components.

Snapshot tests validate generated code.


Generator Tests

The Generator requires the largest test surface.

Recommended categories:

Parser Tests

↓

Validation Tests

↓

Relationship Tests

↓

Identifier Allocation Tests

↓

Metadata Generation Tests

↓

Snapshot Tests

Each stage should be tested independently.


Parser Tests

Parser tests verify discovery of application models.

Example scenarios:

Parser tests should isolate Roslyn analysis from code generation.


Runtime Tests

Runtime tests verify execution behavior independently of SQL.

Examples:

Runtime tests should replace external dependencies with test doubles where practical.


Native AOT Tests

Because Native AOT is a core design goal, compatibility should be validated regularly.

Recommended checks:

No runtime reflection should be introduced.


Continuous Integration

Every pull request should execute:

Builds should fail if generated snapshots change unexpectedly.




← Previous: Code Style Next: ADR Process