Page 1 of 2

Simple Test or phpUnit

Posted: Mon Sep 04, 2006 3:00 pm
by alex.barylski
Which is better and why???

What does Zend use?

Posted: Mon Sep 04, 2006 3:30 pm
by alex.barylski
Edit: I've found there are indeed 2 versions of phpUnit the one on SF is the newbie??? I prefer the other as it has a O'Reilley cookbook ;)

Ok, I've searched for both and have concluded there are at least seperate concurrent versions for phpUnit

One by a fellow named Sebastien(sp?) and the other which pops up as SF when Googled???

I like the Former as it's in version 3.0 but I cannot seem to find the URL to download or instructions, etc???

The SF version only appears to be in BETA???

WTF???

Posted: Mon Sep 04, 2006 3:47 pm
by sweatje
I use SimpleTest because it has more Mock Objects experience, it has a WebTestCase, it is geared towards ease of use out of the box (i.e. having both HTML and CLI based reporters), and I trust Marcus Baker's development decisions (no offence towards Sebastian Bergmann intended)

Posted: Mon Sep 04, 2006 3:50 pm
by alex.barylski
Ok...noticed you in the documentation for SimpleTest ;)

Which one does Zend framework use? Seeing how I'm using ZF I might as well stick with convention...

Posted: Mon Sep 04, 2006 3:50 pm
by feyd
I'll agree with Jason and add: plus Marcus actually posts here!

Posted: Mon Sep 04, 2006 3:53 pm
by sweatje
Hockey wrote:Ok...noticed you in the documentation for SimpleTest ;)
Yep, I like to jump in on the easy parts of projects ;)

Posted: Mon Sep 04, 2006 3:58 pm
by sweatje
Hockey wrote: Which one does Zend framework use? Seeing how I'm using ZF I might as well stick with convention...
http://www.phpunit.de/

Make sure you are installing PHPUnit2 though.

Posted: Mon Sep 04, 2006 3:59 pm
by alex.barylski
Ok fine...two against one...I'm convinced I'll use SimpleTest :P

However you both promise me it's just as complete if not more complete than phpUnit???

And when I have questions you help me :P Just kidding on that last one of course


Cheers :)

Posted: Mon Sep 04, 2006 6:34 pm
by Ollie Saunders
SimpleTest is great except when you want to modify the reporting behaviour. But then PHPUnit doesn't have an HTML Reporter at all so there is a clear winner there.

Marcus is a really nice guy so I'm actually a little guilty I even tried PHPUnit now :(

I'm really looking forward to the PHP 5 version of SimpleTest because the current version doens't cut it with heavy OOP code atm without albeit minor tweakage.

This is essential:

Code: Select all

class BlahWhatever extends UnitTestCase {
    // get the value of a private or protected property, properly and politey
    static function expose($obj, $prop)
    {
        $reflection = new ReflectionClass($obj);
        $prop = $reflection->getProperty($prop);
        return $prop->getValue($obj);
    }
}

Posted: Tue Sep 05, 2006 2:52 am
by sike
ole wrote:SimpleTest is great except when you want to modify the reporting behaviour. But then PHPUnit doesn't have an HTML Reporter at all so there is a clear winner there.

Marcus is a really nice guy so I'm actually a little guilty I even tried PHPUnit now :(

I'm really looking forward to the PHP 5 version of SimpleTest because the current version doens't cut it with heavy OOP code atm without albeit minor tweakage.

This is essential:

Code: Select all

class BlahWhatever extends UnitTestCase {
    // get the value of a private or protected property, properly and politey
    static function expose($obj, $prop)
    {
        $reflection = new ReflectionClass($obj);
        $prop = $reflection->getProperty($prop);
        return $prop->getValue($obj);
    }
}
care to explain why you think exposing protected and private members is essential? in my book you should test the behaviour rather than explicit variables.

cheers
Chris

Posted: Fri Sep 08, 2006 5:33 pm
by Ollie Saunders
I find testing the internals is shorthand for an otherwise very long test of the behaviour.

Oh and that is probably a bad name for the function because it doesn't actually expose the varible just gets its value at one specific moment in time.

Posted: Mon Sep 11, 2006 5:46 am
by sike
i see what you mean - but i think the test knows much too much on the internals of the testee. that could lead to brittle tests imho.

cheers
Chris

Posted: Mon Sep 11, 2006 6:27 am
by Ollie Saunders
Yes you could be right.
I'm out of my depth here really.

Posted: Mon Sep 11, 2006 9:23 am
by Maugrim_The_Reaper
I use SimpleTest. Easy to setup, quick, better support for Mocks and Web Testing, author posts here, PHPUnit stays too close to JUnit (not the best approach for PHP).

PHPUnit Beta is picking up the pace, but testing really only needs the basics and SimpleTest has them all. A fully PHP5 compliant version would be killer. Drop a line if you need help ;).

Posted: Mon Sep 11, 2006 9:33 am
by dbevfat
I use SimpleTest, but have recently decided to take a better look at PHPUnit2, since it has quite a few nice features that ST doesn't, say code coverage for example.

IMO if you're new to testing, then both are "better". ;)