machine.specifications

Machine.Specifications is a Context/Specification framework geared towards removing language noise and simplifying tests.

Github stars Tracking Chart

Documentation

For project documentation, please visit the wiki.

Training

A PluralSight course by @kevinkuebler is available here.

Overview

MSpec is called a "context/specification" test framework because of the "grammar" that is used in describing and coding the tests or "specs". That grammar reads roughly like this

When the system is in such a state, and a certain action occurs, it should do such-and-such or be in some end state.

You should be able to see the components of the traditional Arrange-Act-Assert model in there. To support readability and remove as much "noise" as possible, MSpec eschews the traditional attribute-on-method model of test construction. It instead uses custom .NET delegates that you assign anonymous methods and asks you to name them following a certain convention.

[Subject("Authentication")]
class When_authenticating_an_admin_user
{
    static SecurityService subject;
    static UserToken user_token;

    Establish context = () => 
        subject = new SecurityService();

    Because of = () =>
        user_token = subject.Authenticate("username", "password");

    It should_indicate_the_users_role = () =>
        user_token.Role.ShouldEqual(Roles.Admin);

    It should_have_a_unique_session_id = () =>
        user_token.SessionId.ShouldNotBeNull();
}

Build status

Project, CI, NuGet
--, --, --
Machine.Specifications, ,
Machine.Specifications.Reporting, ,
Machine.Specifications.Runner.Console, ,
Machine.Specifications.Runner.ReSharper, ,
Machine.Specifications.Runner.Rider, ,
Machine.Specifications.Runner.TDNet, ,
Machine.Specifications.Runner.Utility, ,
Machine.Specifications.Runner.VisualStudio, ,
Machine.Specifications.Should, ,
Machine.Fakes, ,

Main metrics

Overview
Name With Ownermachine/machine.specifications
Primary LanguageC#
Program languageC# (Language Count: 3)
Platform
License:MIT License
所有者活动
Created At2009-02-05 03:04:48
Pushed At2025-05-17 22:52:33
Last Commit At2024-12-20 21:29:09
Release Count16
Last Release Namev1.1.3 (Posted on )
First Release Name0.6.0 (Posted on 2013-12-18 23:55:38)
用户参与
Stargazers Count895
Watchers Count45
Fork Count180
Commits Count1.7k
Has Issues Enabled
Issues Count323
Issue Open Count26
Pull Requests Count94
Pull Requests Open Count2
Pull Requests Close Count118
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private