/dotnet-test-mspec

.NET Core / .NET CLI / dotnet test support for Machine.Specifications (MSpec)

Primary LanguageC#MIT LicenseMIT

Roadmap / Kanban Board

What is this?

It's a package that you can install to add support for MSpec (Machine.Specifications) to the .Net CLI / .Net Core / dotnet test.

Get started

The only action that you need to take is to install the dotnet-test-mspec NuGet package in each project with MSpec tests and set the testRunner to mspec:

project.json

  "testRunner": "mspec",
  "dependencies": {
        "Machine.Specifications.Core": "0.5.*",
        "Machine.Specifications.Should.Core": "0.5.*",
        // This comes from the build output of the project: see nuget.config
        "dotnet-test-mspec": {
            "version": "*",
            "type": "build"
        }
    }

Then you can use dotnet test as usual:

> dotnet test

Project Machine.Specifications.Core (.NETCoreApp,Version=v1.0) was previously compiled. Skipping compilation.
Project Machine.Specifications.Should.Core (.NETCoreApp,Version=v1.0) was previously compiled. Skipping compilation.
Project Machine.Specifications.Core.Runner.DotNet.Tests (.NETCoreApp,Version=v1.0) was previously compiled. Skipping compilation.

Specs in Machine.Specifications.Core.Runner.DotNet.Tests:
SampleSpec
┬╗ should be hello
┬╗ should be world
Contexts: 1, Specifications: 2, Time: 0.07 seconds

SUMMARY: Total: 1 targets, Passed: 1, Failed: 0.

Note

This tool uses the .Net Core port of Machine.Specifications here: https://github.com/einari/machine.specifications.core