Reusable Test Fixtures

3 views
Skip to first unread message

Kenneth Xu

unread,
Nov 3, 2009, 2:50:21 PM11/3/09
to NUnit-Discuss
Hi,

Sorry if this question was asked before but I did search he group
archive. Does anybody know if there is an project that has reusable
test fixtures (ideally independent or around NUnit as that's work I
use).

I found my self writing those, for example, test fixtures for value
objects, implementation of collection interfaces and etc.

If you know any please share. I thank you in advance.

Cheers,
Kenneth

Charlie Poole

unread,
Nov 4, 2009, 10:51:45 AM11/4/09
to nunit-...@googlegroups.com
Hi Kenneth,

I don't know of any, but it's a good idea!

Charlie

Kenneth Xu

unread,
Nov 4, 2009, 12:08:06 PM11/4/09
to nunit-...@googlegroups.com
Hi Charlie,

I had written some reusable test fixtures to test functionality of
implementations of various collection interface. They need some clean
up to extract them out of that project.

Yesterday, I wrote another one to test value objects after a debate in
a project meeting on weather we should test value object or not. I
managed to get the test as simple as below so effectively eliminated
the necessity of the debate.

[TestFixture] public class AddressTest :
NewableValueObjectTestFixture<Address> {}

I blogged a bit here:
http://kennethxu.blogspot.com/2009/11/unit-test-value-object.html

If there isn't one, I'm interested to start a project to host them.
Anybody interested can join and contribute. How about a Google Code
project?

Cheers,
Kenneth

Andreas Müller

unread,
Nov 4, 2009, 1:07:06 PM11/4/09
to nunit-...@googlegroups.com
Hi,

my NSTL Project has some reusable test fixtures:

-EquivalentObjectFixture<T> for value objects and objects that override
Equals and GetHashcode()
-EnumerableFixture<T>, CollectionFixture<T> and ListFixture<T> to test
IEnumerable<T>, ICollection<T> and IList<T> implementations.
-EnumerableFixture, CollectionFixture and ListFixture for the non generic
collection interfaces

The source code is available here:
http://nstl.codeplex.com/SourceControl/ListDownloadableCommits.aspx. The
fixtures are located under the following path:
$/nstl/nstl-3.x/Source/nstl.nunit/Support

Please fill free to use it.

Cheers,
Andy


-----Ursprüngliche Nachricht-----
Von: nunit-...@googlegroups.com [mailto:nunit-...@googlegroups.com]
Im Auftrag von Kenneth Xu
Gesendet: Dienstag, 3. November 2009 20:50
An: NUnit-Discuss
Betreff: [nunit-discuss] Reusable Test Fixtures

Kenneth Xu

unread,
Nov 4, 2009, 2:15:15 PM11/4/09
to nunit-...@googlegroups.com
Cool, I'll take a deep look. Thanks Andy!

Cheers,
Kenneth

Adam Connelly

unread,
Nov 6, 2009, 7:34:00 AM11/6/09
to nunit-...@googlegroups.com
I just found something interesting yesterday. It's a project on CodePlex that has support for testing that Properties are wired up correctly, and if the class implements INotifyPropertyChanged it tests that the interface is implemented properly.


It seems quite promising, but I think it could do with a bit more work (which I might think about if I have time).

Maybe not quite a reusable test fixture, but something similar.

Adam

2009/11/4 Kenneth Xu <kenn...@gmail.com>

Charlie Poole

unread,
Nov 6, 2009, 10:03:54 AM11/6/09
to nunit-...@googlegroups.com
Hi Adam,
 
This leads me to wonder whether we shouldn't just make this a category in our "Extensions"
section of the Wiki. We might have to rename it to something that covers stuff like this
as well as extensions.
 
If we did that, rather than trying to create a contrib project somewhere, we could link
to whatever existed, wherever it existed.
 
Charlie


From: nunit-...@googlegroups.com [mailto:nunit-...@googlegroups.com] On Behalf Of Adam Connelly
Sent: Friday, November 06, 2009 4:34 AM
To: nunit-...@googlegroups.com
Subject: [nunit-discuss] Re: Reusable Test Fixtures

Reply all
Reply to author
Forward
0 new messages