Announcing NTestDataBuilder library

Further to the blog post I posted yesterday about the approach to generating test fixture data for automated tests that my team has adopted I have open sourced a base class and other supporting code infrastructure to quickly, tersely and maintainably generate fixture data in a consistent way.

I have released this library to GitHub and NuGet under the name NTestDataBuilder.

The GitHub page has a bunch of code snippets that will get you started quickly. Read my previous blog post to get a feel for how I use the code and in particular how I combine the approach with the Object Mother pattern for best effect.


4 Replies to “Announcing NTestDataBuilder library”

  1. Why did you choose NBuilder instead of AutoFixture?
    ” I have tried both and found autofixture to be far preferable it has a richer syntax is extremely flexible pand was easier to modify for my own use.
    Marks tests are excellent, well written and this mixed with his blog should get you most of the way there.”

    I’ve asked the question “compare NBuilder vs AutoFixture?” on , but didn’t get any response

    1. Hi Michael,

      I’ll be honest – in the past I’ve used AutoFixture (admittedly it was around 2 years ago now) and I didn’t like it compared to NBuilder. I find the NBuilder syntax to be easier to read and write to be honest. I also like that I don’t have to create a fixture object.

      It is undeniable that AutoFixture is much more flexible though with regard to controlling the data being generated.

      In the case of NTestDataBuilder, the main part of NBuilder I’m using it it’s ability to have fine-grained control with a really nice syntax over the creation of a list, which from what I can see AutoFixture doesn’t provide so it wouldn’t be suitable anyway.

      If someone was interested in combining NTestDataBuilder with AutoFixture in order to generate better/random data for the values that would certainly be possible – personally I don’t have a need as I’m happy to specify the default values myself.

      Thanks for the comment!

Leave a Reply

Your email address will not be published. Required fields are marked *