Unit Testing

New Unit Testing Book

New Unit Testing Book

There’s a new book on unit testing coming out from Manning Publishing from author Roy Osherove. The book won’t be available in physical form till later this year, but it looks like some chapters are online at the publisher’s site. From the publisher…

The Art of Unit Testing guides the reader on the journey from beginner to master in the subtle art of unit testing. Based on expert author Roy Osherove’s real-world development experiences, this book shows developers how to make sure the code that they write actually works as expected, and how to make these verifications as automated as possible. Not only that, the book shows techniques that help to make sure that the tests are maintainable, readable, and test the right thing over time, avoiding the “throw-away tests” phenomenon that plagues many shops that try to write unit tests without clear guidelines. In this way it helps you make your development process—and your business—more agile.

Check it out, let us know what you think.

Read more  Permalink |  Comments[1]

Microsoft Team System NUnit Adapter

We’ve prepared a free, open source adapter for NUnit designed to allow you to run Team System tests with NUnit, including nunit-console. This will let you inter-operate with source including Team System unit tests, as well as integrate Team System unit tests into your automated builds and scripts by literally running Team System tests under the NUnit framework.

This is provided as source making an NUnit addin. Place this addin in the appropriate folder depending on where you have NUnit installed, instructions on NUnit addin and extensibility are at http://www.nunit.com/index.php?p=nunitAddins&r=2.4.6.

This same addin is used within TestMatrix to provide the ability to run Team System unit tests, but we’re also providing it free to NUnit users of all kinds. TestMatrix is not required to use this addin. Source is also provided under the same license terms as NUnit itself, so that you can modify or work with this code as you see fit.

Inside the adapter, we’ve implemented a NUnit ’suite builder’, which is really the transformation logic that takes a compiled assembly and extracts the classes and methods that form unit tests. Along with basic unit testing, we’ve a simple, though working data driven test attribute along with a TestContext as used by Team System. This essentially allows you to open a table via ADO.NET and have the test execute once per row.

We’ve not big Team System test users ourselves, preferring NUnit, so this has more of an NUnit ‘feel’, adapting the Team System tests to fit in NUnit. Feedback, particularly on differences in semantics will be appreciated!

You can download it http://www.exactmagic.com/products/mstest/actions/download.html.

  Permalink |  Comments[2]

MS Team System Test Support

New on experimental updates, build 2277 and higher is support for MS Team System unit tests. Now TestMatrix supports NUnit, csUnit, MbUnit, and MSTS all in one runner.

This support is actually provided as a plug in to NUnit, which we’ll be making as a free open source component once we finish testing.

  Permalink |  Comments[0]

NUnit 2.4.6 Support

Fresh build this morning on Experimental updates, NUnit 2.4.6 is supported in releases 2237 and higher.

  Permalink |  Comments[0]

Threading Model

Build 2231 (available on Experimental Updates) and later now supports setting the threading model for test runs to STA, which is the default, or MTA. This lets you exercise your code under test with different COM Apartment threading models, which is pretty useful if you know what this means — and not so useful otherwise.

The default is STA, which lets you get at Windows Forms functionality, such as the clipboard in test, and roughly corresponds to [STAThread] around your method mains for Windows Forms applications. In this mode, you can make ‘unit tests’ that show individual controls and exercise them through API calls to help test user interface.

Access this from TestMatrix | Options on the menu.

  Permalink |  Comments[0]