John Goering
John Goering

Reputation: 39030

What is the equivalent to JUnit in C#?

I am coming from Java and am currently working on a C# project. What is the recommended way to go about a) unit testing existing C# code and b) accomplishing TDD for C# development?

Also is there an equivalent to EMMA / EclEmma (free yet powerful code coverage tool) for Visual Studio and C# code?

Upvotes: 8

Views: 31552

Answers (10)

aridlehoover
aridlehoover

Reputation: 3585

Regarding your question about unit test frameworks:

NUnit 1.0 was a direct port of JUnit. NUnit 2.0 moved away from JUnit syntax in order to take advantage of the .NET platform. xUnit.net is a newer unit test framework (from Jim Newkirk - one of the NUnit 2.0 developers - and Brad Wilson) that states as a goal exposing "advances in other unit test library implementations that have not really surfaced in .NET," which I read as "keeping up with JUnit."

Upvotes: 3

Oliver Hallam
Oliver Hallam

Reputation: 4262

I would highly recommend Gallio (formally mbUnit) for unit testing, and (unfortunately not free) NCover for code coverage.

Upvotes: 4

Omar Kooheji
Omar Kooheji

Reputation: 55760

I'd install:

  1. NUnit for your Unit testing framework http://www.nunit.org/index.php
  2. Test driven.net for runing your tests http://www.testdriven.net/
  3. Rhino Mocks as your mockign framework http://ayende.com/projects/rhino-mocks.aspx

As and aside I find it odd that the NUnit guys seem to be using php to host their homepage...

Upvotes: 1

Jon Skeet
Jon Skeet

Reputation: 1500495

Unit test framework: NUnit

Unit test runner: Various, but personally I like the one in ReSharper. (ReSharper costs money, but is easily worth it for the various productivity improvements.)

Coverage: NCover (I think this used to be free, but it now costs money. Hmm.)

Upvotes: 6

Chad Moran
Chad Moran

Reputation: 12854

NUnit for sure.

Upvotes: 2

Darcy Casselman
Darcy Casselman

Reputation: 2644

VS2008 Professional has the Team System unit testing functionality baked in.

Upvotes: 2

Keith
Keith

Reputation: 155662

NUnit, but NCover is only part of the answer as it isn't free. I've asked elsewhere about that.

Upvotes: 2

Chris Wenham
Chris Wenham

Reputation: 24017

NUnit is patterned after JUnit, but if you're using Visual Studio 2008 then consider the built-in unit testing framework.

Upvotes: 9

Adam Haile
Adam Haile

Reputation: 31329

NUnit would be it.

Upvotes: 2

Jacek Szymański
Jacek Szymański

Reputation: 2664

1 Nunit
2 NCover or
3 PartCover (I never used it)

Upvotes: 18

Related Questions