This project has moved and is read-only. For the latest updates, please go here.

Unit Tests

Topics: Developer Forum
May 5, 2009 at 3:30 PM
Edited May 5, 2009 at 3:30 PM
Does the farseer project have unit tests?

I could not see any. However i am sure alot of the code gets quite complex, with a lot of things subtly affecting other things. I would have thought regression tests would help with the stability of the project.

In the best case, every time code is committed to fix a bug, a unit test (or more) is added to make sure that bug doesn't come back. These would preferrably be included when ever ppl submit a patch.

I know of other Open Source projects which won't even look at a patch unless there is a unit test included.

p.s. unit tests also help to document the code. Because ppl will often look at the unit tests to see how things can/should be used.

</Rant> :)
May 5, 2009 at 6:54 PM
Unit tests were actually one of the things I wanted to include in Farseer Physics back when I joined the project. Problem is that it's time consuming to write unit tests and it's hard to write good and covering unit tests that has a reason to exist.

By that I mean that all the code in Farseer Physics pretty much hang together in a chain of links. If you break even the smallest link, the whole chain blow up. Pretty easy to detect whenever you have f***ed up ;)

I myself come from a hybrid between XP and TDD development envioronemnts and I am used to writing unit tests before starting to code. But the main problem has been finding the time to do it. It is one of two projects I'll try to be active on, while going to school (full time) and doing my 4 jobs. It is not always easy.
I'll write it down on my todo list, I will get it done at some point, but probably not with 100% coverage and the quality might not be that great. Thanks for the information and suggestion.
May 6, 2009 at 9:24 AM
Trust me, i know how hard it is to start adding unit tests in a project that was written without any.

We are doing the same thing at work. We have a *huge* system with no unit tests and just started adding unit tests about 6 months ago. The problem is that it feels like it isn't worth the effort because you don't actually start seeing the benifits until you have a fair bit of the code covered (and you start going back and modifying old areas of code).

They are also only usefull if they get run when ever a commit is made. Or at least on a regular interval.

I was mainly just wondering if they existed somewhere where i couldn't see them. Or if i should be submitting unit tests when submitting patches.