Prova Architecture
NOTE
Prova is an Experimental Research Prototype for Native AOT testing. It is a standalone project independent of Microsoft. While it is a custom runner, it supports the Microsoft Testing Platform (MTP) via a hybrid adapter.
Directory Structure
src/
Prova.Core/ # Runtime Library (Attributes, Assert, Interfaces)
Prova.Generators/ # Roslyn Source Generators (Analysis, Emission using SyntaxProvider)
tests/
Prova.Core.Tests/ # Unit tests for the runtime library
Prova.Generators.Tests/ # Integration tests for the Source Generator (Verify)
samples/
Prova.Demo/ # Showcase Console App
Prova.MtpSample/ # Microsoft Testing Platform integration sample
Prova.Skugga.Demo/ # Skugga (Mocking) integration sampleThe Pipeline
Code Analysis (
SyntaxAnalyzer):- Scans for
[Fact],[Theory]. - Extracts Metadata:
[Retry],[Focus],[Trait], XML Docs. - Validates Signatures (Must be
voidorTask).
- Scans for
Model Creation:
- Converts Roslyn Symbols (
IMethodSymbol) into simple Records (TestMethodModel). - Resolves dependencies (
IClassFixture,ITestOutputHelper).
- Converts Roslyn Symbols (
Code Emission (
SourceEmitter):- Generates
Prova.Generated.TestRunnerExecutor. - Injects
Mainentry point logic. - Handles Try/Catch, Interlocked counters, and Reporter callbacks.
- Generates
Key Components
ITestReporter
Abstraction for reporting results. Currently ConsoleReporter is implemented, but this allows for:
- TRX Reporters (CI)
- JSON Reporters
- GitHub Actions Reporters
ITestOutputHelper
Captures output per test.
- Prova generates a local
TestOutputHelperfor each test. - Output is passed to the reporter only upon test completion (to prevent interleaved console garbage).
IClassFixture<T>
Simple Dependency Injection.
- Isolated Scope: Currently created per-test for maximum AOT safety and parallel isolation.
- Injected: Passed to the Test Class constructor.
- Lifecycle:
InitializeAsync-> Test Runs ->DisposeAsync.