Why testFixture instead of TestClass?

I respect Mike Two’s response, but I would assert that the NUnit team got this very wrong, and the use of [TestFixture] is a semantic wart on the face of NUnit. A test class is not a fixture. From what I’ve dug into with regard to JUnit, I have not found any reference to a test class as a test fixture, nor have I found much discussion about “test fixtures” referring to test classes. Rather, all the JUnit/xUnit discussion about fixtures pertain to setup and teardown, which, of course, are the common methods used to set up actual test fixtures.

Note that in NUnit 2.5, you can remove the [TestFixture] annotation.

Update: (July 2012)

I was just reading the Cucumber Book and on page 99, author Matt Wynne explains the origin of using “fixture.” I quote:

There is a long tradition (coming from the hardware world, where test fixtures originated) of calling the link between the test system and the system under test a fixture. This is the “glue code” role that we’ve referred to in this book as automation code. The FIT testing framework uses this meaning of the term.
Some unit testing tools (such as NUnit) have further confused the issue by referring to the test case class itself as a fixture. So much for a ubiquitous language! (Wynne & Hellesoy, 2012)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)