Questions tagged [mspec]

Machine.Specifications is a context/specification framework for C#. Not to be confused with the mspec Ruby framework (tag [mspec-ruby]) used in RubySpecs.

Machine.Specifications is a context/specification framework for C# geared towards removing language noise and simplifying tests.

215 questions
40
votes
1 answer

Am I writing my first MSpec specifications correctly?

I'm writing my first MSpec specifications and I wanted some guidance. I left the specs in the "pending" state, but the context is filled out. Are there any improvements to be made? For reference, this is the story and first scenario: Story: "Blog…
Sekhat
  • 4,435
  • 6
  • 43
  • 50
24
votes
5 answers

How do I write context/specification style unit tests with an MSTest/xUnit framework?

I have been using MSpec to write my unit tests and really prefer the BDD style, I think it's a lot more readable. I'm now using Silverlight which MSpec doesn't support so I'm having to use MSTest but would still like to maintain a BDD style so am…
Charlie
  • 10,227
  • 10
  • 51
  • 92
21
votes
9 answers

What are some strategies for testing large state machines?

I inherited a large and fairly complex state machine. It has 31 possible states, all are really needed (big business process). It has the following inputs: Enum: Current State (so 0 -> 30) Enum: source (currently only 2 entries) Boolean:…
Pondidum
  • 11,457
  • 8
  • 50
  • 69
16
votes
2 answers

MSpec and SpecFlow when to use which? What are the advantages/disadvantages of either?

I am trying to get started with BDD and found a view blog posts about MSpec and SpecFlow. I'm currently not quite sure when I would use which and what the advantages/disadvantages of either framework are. Looking at the documentation it seems that…
b3n
  • 3,805
  • 5
  • 31
  • 46
14
votes
2 answers

Where can I find MSpec documentation?

Just discovered MSpec, and want to try it out. However, I can't find any detailed docs on it, except for a few quick tutorials - do they exist ?
Evgeni
  • 3,341
  • 7
  • 37
  • 64
13
votes
1 answer

Should I use specflow at unit test level?

Possible Duplicate: SpecFlow/BDD for Unit Tests? Over the last few years I have worked in TDD using NUnit/Moq and over the last few months I have been getting to grips with BDD using mSpec. So far so good but we now want to move more into…
JD.
  • 15,171
  • 21
  • 86
  • 159
11
votes
2 answers

How do I do unit & integration testing in a BDD style in ASP.NET MVC?

I am learning Behavior Driven Development with ASP.NET MVC and, based on a post from Steve Sanderson, understand that BDD can mean, at least, the following test types: individual units of code & UI interactions. Something similar is mentioned in…
Yasir
  • 1,595
  • 5
  • 23
  • 42
10
votes
1 answer

How to integrate MSpec with MS Build?

Few days ago I watched a BDD screencast by Rob Conery. In the video he showed how to use MSpec, so I downloaded it and played with the bits. What I want now is to integrate MSpec with MS Build, but I don't know how... I use TFS team build as my CI…
Pavel Nikolov
  • 9,401
  • 5
  • 43
  • 55
10
votes
1 answer

Is it possible to create data driven tests with MSpec?

With MSpec is it possible to create data driven tests? For example, NUnit has the TestCase attribute that allows for multiple data driven cases. [TestFixture] public class ExampleOfTestCases { [TestCase(1,2,3)] [TestCase(3,3,6)] …
Aeden
  • 101
  • 4
10
votes
4 answers

Is there a way to share assertions among test classes without inheritance in NUnit?

In MSpec there is a neat feature that allows you share assertions between multiple tests. They're called "behaviors" Behaviours define reusable specs that encapsulate a particular set of, you guessed it, behaviours; you’re then able to include…
ptomasroos
  • 1,129
  • 1
  • 9
  • 18
8
votes
1 answer

MSpec on Appharbor

It it possible to execute mspec tests on appharbor aside from adding build action ?
Sly
  • 15,046
  • 12
  • 60
  • 89
8
votes
2 answers

How do I write generic tests for all implementations of an interface with MSpec?

I have an interface IAudioProcessor with a single method IEnumerable Process(IEnumerable samples). While it is not a requirement of the interface itself, I want to make sure that all my implementations follow some common rules, like…
Daniel Hilgarth
  • 171,043
  • 40
  • 335
  • 443
8
votes
1 answer

How do I run setup and teardown code with each test in MSpec?

I have generic code for setting up and tearing down NHibernate, which I need on pretty much all my tests. Is there a way to include the 'need for all tests' code in one place, then have it applied to all tests? (ie like Nunit's setup and teardown…
Alistair
  • 1,939
  • 2
  • 22
  • 31
8
votes
2 answers

How to output a message with an It assertion in MSpec

We're using MSpec for unit tests after having previously used MbUnit. I'm used to being able to say Assert.IsTrue(status, "Status should be true"); in MbUnit, i.e. adding a message to the assertion which is output if it fails. I can't find any…
Mark Pim
  • 9,898
  • 7
  • 40
  • 59
7
votes
1 answer

Using Machine.Fakes and WithSubject how do you tell the framework to use a specific constructor argument value when creating the subject

I would like to tell the Machine.Fakes framework to use a specific value for a constructor argument when creating the subject The subject under test has the following constructor /// /// Initializes a new instance of the
Edward Wilde
  • 25,967
  • 8
  • 55
  • 64
1
2 3
14 15