A modern, source-generated test composition framework for .NET.
Compono is a modular framework for composing complete test environments in modern .NET applications.
Rather than focusing solely on object generation, Compono composes object graphs, shared dependencies, test doubles, semantic data, and reusable conventions into a single, deterministic model.
Modern .NET has evolved. Compono embraces source generators, records, required members, nullable reference types, trimming, and Native AOT instead of building around runtime reflection.
The goal isn't to recreate AutoFixture. It's to rethink test composition from first principles.
- Composition over object generation
- Predictability over magic
- Source-generated by default
- Deterministic by design
- Performance is a feature
- Diagnostics are a product feature
- Modular architecture
Tests declare what they need.
Compono determines how those requirements are satisfied.
Package Description
Compono Core composition engine with built-in source generator
Compono.XunitV3 xUnit v3 integration
Compono.NSubstitute Automatic NSubstitute composition
Compono.Bogus Semantic fake data integration
var composition = Compono.Create(builder =>
{
builder.UseNSubstitute();
builder.UseBogus();
});
var customer = composition.Create<Customer>();Runtime reflection is intentionally not part of the default execution model.
If compatibility support is ever introduced, it will require an explicit opt-in.
Generated construction (composer.Create<T>()) runs ~6.0x faster than an
equivalent reflection-based baseline, and within ~1 ns of a bare
new Leaf(), for the flat-type case Milestone 1 can measure end-to-end
today. A separate ecosystem-comparison benchmark against AutoFixture is
also included as a recognizable reference point - not a claim Compono
replaces it. See
Performance (or
docs/performance.md) for methodology, caveats, and how to reproduce -
benchmarks/Compono.Benchmarks.
See the /docs directory for the manifesto, architecture, public API,
performance, MVP roadmap, design principles, and ADRs.
Compono is under active development. APIs are experimental until the first public preview.
MIT