Skip to content

Compono

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.

Why Compono?

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.

Philosophy

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

Packages

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

Example

var composition = Compono.Create(builder =>
{
    builder.UseNSubstitute();
    builder.UseBogus();
});

var customer = composition.Create<Customer>();

Source Generation First

Runtime reflection is intentionally not part of the default execution model.

If compatibility support is ever introduced, it will require an explicit opt-in.

Performance

Generated construction (composer.Create<T>()) runs ~6.1x faster and allocates ~43% as much as an equivalent reflection-based baseline, for the flat-type case Milestone 1 can measure end-to-end today. See Performance for methodology, caveats, and how to reproduce - benchmarks/Compono.Benchmarks.

Status

Compono is under active development. APIs are experimental until the first public preview.

See the Manifesto, Architecture, Design Principles, Public API, Performance, MVP, and ADRs for more.