Aaron Jensen

Sponsors

The Lounge

Advertisement

Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
MSpec v0.2

EDIT:Machine, including MSpec are now hosted on github: http://github.com/machine/machine

It's been a while, but we've gotten several new things into Machine.Specifications (MSpec). I'm excited to finally release them for everyone to start playing with. Don't know what MSpec is? Please, read my original post. You can grab the bits here.

Let's talk about what's new though. Here's an example of a new context/spec:

  [Concern("Console runner")]
  public class when_specifying_a_missing_assembly_on_the_command_line
  {
    Establish context = ()=>
    {
      console = new FakeConsole();
      program = new Program(console);
    };

    Because of = ()=>
      exitCode = program.Run(new string[] {missingAssemblyName});

    It should_output_an_error_message_with_the_name_of_the_missing_assembly = ()=>
      console.Lines.ShouldContain(string.Format(Resources.MissingAssemblyError, 
      missingAssemblyName));

    It should_return_the_Error_exit_code = ()=>
      exitCode.ShouldEqual(ExitCode.Error);

    const string missingAssemblyName = "Some.Missing.Assembly.dll";
    public static ExitCode exitCode;
    public static Program program;
    public static FakeConsole console;
  }

There have been a few semantic changes

  • The Description attribute has been removed. There is now an optional Concern attribute that allows you to specify a type and/or a string that the context/spec is concerned with.
  • Context before_each is now Establish context.
  • Context before_all is now Establish context_once.
  • Context after_each is now Cleanup after_each.
  • Context after_all is now Cleanup after_each.
  • When {...} is now Because of. This is closer to SpecUnit.NET's verbage, and doesn't force you to specify the "when" twice.

There is now a console runner

We don't quite have all the options we want yet, but the basics of the runner are working. Here's the help from the runner:

We also stole Bellware's SpecUnit.NET reporting stuff and ported it over. You can now generate a report on your specs with the --html switch. Here's an example run:

This is the report it generates.

Want to try it out?

  1. Grab the drop here.
  2. Extract it somewhere. Put it somewhere semi-permanent because the TestDriven.NET runner will need a static location for the MSpec TDNet Runner.
  3. If you want TestDriven.NET support, run InstallTDNetRunner.bat
  4. Check out the example in Machine.Specifications.Example. Note that you can run with TD.NET.
  5. Create a project of your own. Just add Machine.Specifications.dll and get started.
  6. Send me feedback! Leave comments, email me, tweet me, whatever.

Also, this is part of Machine, so feel free to take a look at the code and/or submit patches. There's also a Gallio adapter in there, but I didn't include it in the release as it's not quite polished enough yet. If you're interested in it, talk to me. Special thanks to Scott Bellware, Jeff Brown and Jamie Cansdale for their help and support. Also, extra special thanks to Eleutian's newest dev, Jeff Olson for much of the recent work that has gone into MSpec!


Posted 09-02-2008 2:52 PM by aaronjensen

[Advertisement]

Comments

Scott wrote re: MSpec v0.2
on 09-02-2008 6:01 PM

Looks awesome man, I'll grab it and run it through its paces this week!  I'm glad you guys  (you and Scott) put your heads together.  Thanks!

DotNetKicks.com wrote MSpec v0.2
on 09-02-2008 7:02 PM

You've been kicked (a good thing) - Trackback from DotNetKicks.com

Reflective Perspective - Chris Alcock » The Morning Brew #171 wrote Reflective Perspective - Chris Alcock » The Morning Brew #171
on 09-03-2008 3:04 AM

Pingback from  Reflective Perspective - Chris Alcock  » The Morning Brew #171

Joe Ocampo wrote re: MSpec v0.2
on 09-03-2008 8:44 AM

This is really awesome.  I will have put it through it's paces.

Dew Drop - September 3, 2008 | Alvin Ashcraft's Morning Dew wrote Dew Drop - September 3, 2008 | Alvin Ashcraft's Morning Dew
on 09-03-2008 9:08 AM

Pingback from  Dew Drop - September 3, 2008 | Alvin Ashcraft's Morning Dew

Bj??rn Rochel’s weblog » A new syntax for xUnit.BDDExtensions ??? wrote Bj??rn Rochel’s weblog » A new syntax for xUnit.BDDExtensions ???
on 11-27-2008 8:22 AM

Pingback from  Bj??rn Rochel’s weblog » A new syntax for xUnit.BDDExtensions ???

Peter wrote re: MSpec v0.2
on 03-17-2009 10:52 PM

I'm not sure if this was something I did or something I should have done. I should start by describing what I did at first, then describing how I enabled TD.NET integration:

1. Downloaded MSpec (specifically Machine.Specifications from the Machine page) from Github.

2. Opened Machine.Specifications.sln, F5 built it.

3. Oops, cleaned out Debug dir, switched to Release mode, F5 built it.

4. Copied entire source/distro/everything to %PROGRAMFILES%\mspec

5. Found Distribution\Specifications\ directory and ran InstallTDNetRunner.bat

... this is when I reported the problem. Step 6 (fixed the problem) is:

6. Copied Machine.Specifications.TDNetRunner.dll from Release\ folder to the Distribution\Specifications\ folder (this is where batch file/registry hack in #5 told TD.NET to look)

Anyway thanks for your attention, this is resolved.

#.think.in wrote #.think.in infoDose #31 (24th May - 1st June)
on 06-01-2009 9:12 AM

#.think.in infoDose #31 (24th May - 1st June)

Add a Comment

(required)  
(optional)
(required)  
Remember Me?