New unit testing framework?

Discussion of testing theory and practice, including methodologies (such as TDD, BDD, DDD, Agile, XP) and software - anything to do with testing goes here. (Formerly "The Testing Side of Development")

Moderator: General Moderators

lastcraft
Forum Commoner
Posts: 80
Joined: Sat Jul 12, 2003 10:31 pm
Location: London

Re: New unit testing framework?

Post by lastcraft »

Hi...
The Ninja Space Goat wrote:Does anybody know if a newer testing framework than PHPUnit / simpletest is being developedor has been developed? I mean, these work fine, but they just seem out-dated and neither have the most ideal interface. I'm a little surprised these two libraries are the best PHP has to offer. Don't get me wrong, I love simpletest, but I'm just convinced it could be done much better.
Well, I'm certainly interested in how you think It should work. Any "ideal code" you have in mind. Feel free to post it here, or to our own mail list.

The 1.1 release is complete bar some minor bug fixes, compatibility checks (it works with PHP 5.0.3 to 6 we hope) and most annoying of all, the documentation update. That part is drudge, but half done.

Once the compatibility 1.1 release is out, SimpleTest gets a big overhaul. It's been very delayed by my personal circumstances (long work hours, selling houses and stuff) and other projects (conference, Phemto, CGreen). Most of the new code ideas have already been spiked. Just need to set aside time to do it. It will take a little time still, but it is about to get priority.

The mocking will get the biggest overhaul (with a legacy version for backward compatibility). YayMock will certainly be an option, but the fluent interface language needs to be put through the mill first.

yours, Marcus
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Re: New unit testing framework?

Post by Luke »

Thanks for the response Marcus. I will try and find the time to put together a few examples of how I think the interface could be improved. Mostly where I feel it is lacking is in mocking. YayMock does a lot of what I'd like to see (I totally forgot about YayMock, and I didn't know Chris was still working on it), although I'd like to see the new interface chris wants to implement.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: New unit testing framework?

Post by Chris Corbyn »

I'm going to push an update to Yay Mock soon, based on things I've "wished for" whilst using it extensively myself:

* Dropping the need for using Expectations::create()
* Allowing expectation of multiple mocks in one shot oneOf(array($observerA, $observerB))->notify($message); mostly for the allowing() and ignoring() cardinal clauses.
* Allowing '*' and '?' to be used in place of optional() and any() for arguments. Direly needed.
* Automatic integration with SimpleTest if a "yay_simpletest.php" file is loaded (just registers as an observer in the currently running test case). So you don't need to explicitly make the assertion that the expectations were satisfied.
* Ability to override expectations after fixture setup (i.e. when you have a default fixture setup for say, an SMTP conversation and you want to give a bad response in place of the default "correct" response)

I've entirely replaced all simpletest mock object code with yay in Swift Mailer and it's given me a lot of flexibility.

Thankfully it's dreadfully simple in the way it all works so I could probably knock all that over in half a day or so... it's just finding that half day!

I'm looking forward to seeing what happens with Mock object code in SimpleTest though. I do read all the emails that come through on the mailing list :)

I want to change the name and shorten the class names too... perhaps call it Mimmock (as in Mimmick) and use a simple MM prefix on class names rather than lots of underscores. I figure with this sort of thing it's better to have the least amount of typing possible.

EDIT | I'll set myself a deadline of Saturday 10th Jan to get it done :P
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Re: New unit testing framework?

Post by Jenk »

To whom it may concern.. it's very much worth considering the option of having your test library/framework detecting a test case or spec that does not have any asserts or expectations set. I.e. a blank test should not pass because it doesn't test anything!

I've implemented this behaviour into SSpec (for Squeak - Smalltalk) and it has been met with much gratitude. :)
Post Reply