Page 1 of 1

Which unit test framework should I use?

Posted: Wed Jan 13, 2010 2:45 pm
by Delpheno
What's recommended for beginners? I'm leaning towards PHPSpec with all the BDD thing they got going for them. I'm wondering if this will be a disadvantage in the long run. Are all unit test framework easy to pick up and learn?

Thank you.

Re: Which unit test framework should I use?

Posted: Thu Jan 21, 2010 7:13 pm
by alex.barylski
I would think SimpleTest is probably easiest (hence the name) to get started with and can technically accomplish the same end result as PHPSpec in terms of BDD, but using the prefix 'test' as opposed to 'should' which *might* influence your ability to properly specify the behavior as opposed to testing the result, which there is a difference.

If you have never written tests before, then it might be benefitial to start with BDD, hard to say, it's certainly what the advocates would suggest. Then again, personally, I think learning TDD before BDD is important, but there are others who would argue, doing TDD correctly is doing BDD.

SimpleTest, PHPUnit and PHPSpec (I assume) all support mock objects which is technically required for testing behavior (a blur on nomenclature there -- as I believe to purists of either technique BDD/TDD would not use those two words in the same sentance).

I think it boils down to personal preference, read the docs for each, setup each, which ever you get u and using fastest and feel most at home with, use.

Cheers,
Alex

Re: Which unit test framework should I use?

Posted: Sat Jan 23, 2010 9:19 am
by josh
PHPUnit is the only thing with code coverage & file based test aggregation (you can say hey phpunit run all the tests in this folder over there recursively)