Alchemist

Generate placeholder unit tests for .NET solutions.

Unit Test Project

Generates a unit test project with placeholder unit tests.

Framework Choices

Supports multiple unit testing frameworks, together with their attributes and assertions.

Regeneration Choices

Supports multiple options to handle existing unit tests.

Install

Install

Install Alchemist From NuGet

Global
dotnet tool install --global KuBuCo.Alchemist
Terminal screenshot showing the global install process.
Local
dotnet new tool-manifest dotnet tool install KuBuCo.Alchemist
Terminal screenshot showing the local install process.
Usage

Usage

Choose a Solution and Framework

Default

alchemist --solution ./mysolution.sln Terminal screenshot showing a run with the default framework.

Framework

alchemist --solution ./mysolution.sln --framework nunit Terminal screenshot showing a run with a framework option.

Regeneration

alchemist --solution ./mysolution.sln --regeneration.mode update Terminal screenshot showing a run with regeneration mode.

Use alchemist-demo to familiarise yourself with Alchemist.

Example

Example

Consistent Unit Test Scaffolds

Source

namespace example;

public sealed class Calculator
{
    public int Add(int left, int right)
    {
        return left + right;
    }
}

Unit Test

using Xunit;

namespace UnitTests.Example;

public class CalculatorUnitTests
{
    // [UnitTestID=6A1B2C3D4E5F6789]
    [Fact(Skip = "Unit test not implemented.")]
    public void Add_UnitTestPlaceholder()
    {
        Assert.True(false, "Scaffolded Unit Test");
    }
}
Details

Details

Added Value

Project Structure

Generates a UnitTests/UnitTests.csproj, adds project references back to the examined projects and writes matching *UnitTests.cs files.

Dependencies

Adds the selected test framework together with shared dependencies.

Method Shape

Generates public placeholders named <SourceMethodName>_UnitTestPlaceholder with optional UnitTestID comments for reruns.

Runtime Fit

Targets .NET 8 although the examined solution can target newer versions as long as these are installed.

Reruns

Reruns

Control How Existing Files Are Handled

Skip

Retains existing files and adds missing generated members.

Update

Replaces matching generated methods and appends newly generated members.

Replace

Overwrites the target unit test file.

Labels

Labels

Keep Reruns Stable

alchemist --solution ./mysolution.sln --regeneration.labels false

Labels can be disabled, but keeping UnitTestID comments is recommended for repeat generation.

// [UnitTestID=6A1B2C3D4E5F6789]
[Fact(Skip = "Unit test not implemented.")]
public void Add_UnitTestPlaceholder()
{
    Assert.True(false, "Scaffolded Unit Test");
}
Limits

Limits

Boundaries

Limitations

  • The generated unit tests are starting points, not complete implementations.
  • Unit test generation addresses public methods.
  • Source projects must be supported ones that share one target framework.

Use

  • Alchemist is all-rights-reserved software.
  • Use is limited to personal, educational, non-commercial evaluation and non-commercial testing.
  • Commercial use, redistribution, hosting and sublicensing are not permitted.
  • Read the License Here