Skip to content

Repository files navigation

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 composer = Composer.Create(builder =>
{
    builder.UseNSubstitute();
    builder.UseBogus();
});

var customer = composer.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.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.

Getting Started

New to Compono? Start at the Getting Started guide — installation, a first composed test, and curated learning paths for different starting points (new to Compono, migrating from AutoFixture, using xUnit, using NSubstitute).

Migrating from AutoFixture? See the AutoFixture migration guide.

Documentation

The full documentation site is at layeredcraft.github.io/compono. See the /docs directory for the manifesto, architecture, public API, performance, MVP roadmap, design principles, and ADRs.

Status

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

License

MIT

About

A modern, source-generated test composition framework for .NET.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages