background preloader


Facebook Twitter

Yet Another Lambda Blog » Code testing in Haskell. A few weeks ago I wrote that for 3 years I used Matlab as my main programming language.

Yet Another Lambda Blog » Code testing in Haskell

Before that however I was developing in Java. While Java can be criticized for its design – and I noticed that some Haskallers look down on it – it learned me one very important thing: code testing. Java’s JUnit was very important in popularizing Test Driven Development (TDD) and code testing in general. Personally, I never used JUnit and relied on TestNG instead. At the time I was learning TDD TestNG’s features were way ahead of JUnit (and it is possible that they still are). Before I begin with presenting my approach to testing in Haskell it is important to say why did I even bother to spend so much time and effort trying to figure out test organization. Separate tests from the actual source code so that release version of my software doesn’t depend on testing libraries,organize tests in such a way that they are easy to manage (e.g. Rhino Mocks 3.5 - Ayende @ Wiki. Rhino Mocks 3.5 introduces some new concepts, mostly by building upon the language features of C# 3.0.

Rhino Mocks 3.5 - Ayende @ Wiki

Users on the 2.0 platform need not worry, there are enough goodies for them as well (inline constraints, for example), but the focus of this document is on the use of Rhino Mocks with C# 3.0. Edit New things in Rhino Mocks 3.5:Arrange, Act, Assert modelLambda and C# 3.0 extensionsInline constraintsProperty Setters Explicit Expectation APISupport for mocking interface in C++ that mix native and managed types.Allow a mock object to return to record mode without losing its expectationsCreateMock was deprecated in favor of StrictMockBetter error handling in edge cases.Fixed an issue with mocking internal classes and interfacesNew event raising syntaxEdit In general, I recommend following the principle of "Test only one thing per test".

Applying this to Rhino Mocks (and mocking in general), each unit test should validate no more than one significant interaction with another object. Edit Edit. TDD : Introduction to Rhino Mocks. Rhino Mocks is the most popular Mock Object Framework for .NET.

TDD : Introduction to Rhino Mocks

The purpose of this blog entry is to provide a brief introduction to Rhino Mocks. In particular, I want to describe how you can use Rhino Mocks when building ASP.NET MVC web applications. In the first part of this entry, I explain why Mock Object Frameworks are critical tools when performing Test-Driven Development. Next, I discuss how you can use Rhino Mocks to create both state verification unit tests and behavior verification unit tests. Finally, I discuss how Rhino Mocks forces you to design your ASP.NET MVC web applications in a particular way. Why Mock? Why should you care about Mock Object Frameworks such as Rhino Mocks? A unit test enables you to test a single unit of code in isolation. MoQ now uses xUnit for its unit tests.

After talking to a few guys during the MVP summit and the proceedings of the ALT.NET conference, I decided to give xUnit a serious try.

MoQ now uses xUnit for its unit tests

I’m quite pleased with it. Using .NET idioms rather than excessive attributes (i.e. [SetUp] vs class constructor, [TearDown] vs IDisposable, etc.) is a good thing. "Upgrading" was quite easy: for the most part, it was a search & replace of: [Test] => [Fact] [SetUp] => "" [TearDown] => "" Assert.That => Assert.True Assert.Fail => Assert.True(false, Assert.Isxxx => Assert.Arexxx => The only tricky one which took the most time was replacing all the [ExpectedException] attributes with Assert.Throws. Renaming [Test] to [Fact] also has IMO a very good consequence: it forces you to think about your test method names as fact statements that make sense as an english sentence. [Fact]public void InvokeWithTwoArgs() you can no longer say that the method name expresses a fact. Contrib. - Unit testing framework for C# and .NET (a successor to NUnit)

Download. Current Stable Release: NUnit 2.6.3 Under Development: NUnit 2.9.6 Download Types The following types of downloads are provided: Windows installer packages (marked win) are for use on Windows under Microsoft .NET or Mono.


Zipped source packages (src) are provided for those who plan to contribute to the NUnit project or to modify NUnit for their own use. Instructions for installing each of these are found on the Installation page linked to from the Documentation for the particular release. Older Releases These releases are needed by many people for legacy work, so we keep them around for download.