SitePoint Sponsor

User Tag List

Page 1 of 3 123 LastLast
Results 1 to 25 of 59

Hybrid View

  1. #1
    SitePoint Evangelist jplush76's Avatar
    Join Date
    Nov 2003
    Location
    Los Angeles, CA
    Posts
    460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SimpleTest vs PHPUnit?

    We have a framework started in PHPUnit (Bergmann's) for our unit testing stuff here however its a very small subset of our code and I've found I enjoy working with SimpleTest more but thats not enough to justify why I should port over to SimpleTest. We're going to be getting more invested in Unit Testing here which means alot of time devoted to one of these packages.

    I was curious if anyone out there might have some concrete examples of what might make SimpleTest superior to PHPUnit or if they really are just the same.


    thanks
    My-Bic - Easiest AJAX/PHP Framework Around
    Now Debug PHP scripts with Firebug!

  2. #2
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1. I think SimpleTest can run most PHPUnit tests anyway, so perhaps no reason to port legacy tests
    2. MockObject support (though I think Marcus has some documentation regarding how you could use SimpleTest Mocks with PHPUnit)
    3. WebTestCase
    4. the author and many avid users/maintainers post here

    HTH
    Jason Sweat ZCE - jsweat_php@yahoo.com
    Book: PHP Patterns
    Good Stuff: SimpleTest PHPUnit FireFox ADOdb YUI
    Detestable (adjective): software that isn't testable.

  3. #3
    SitePoint Guru
    Join Date
    Oct 2001
    Posts
    656
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wish PHP Eclipse would support it...

    Love the support it has for JUnit

  4. #4
    SitePoint Zealot
    Join Date
    Jun 2004
    Location
    Bogota
    Posts
    101
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Captain Proton
    I wish PHP Eclipse would support it...

    Love the support it has for JUnit
    Definetively!

    I think there's not too much to be done at the php level, but for the PHPEclipse plugin. This would make eclipse the killer IDE for PHP IMHO.

    Does anyone know if such a feature is too hard to implement?
    If I have wings, why am I walking?

  5. #5
    ********* Victim lastcraft's Avatar
    Join Date
    Apr 2003
    Location
    London
    Posts
    2,423
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hi...

    Quote Originally Posted by Captain Proton
    I wish PHP Eclipse would support it...

    Love the support it has for JUnit
    I have just been sent a SimpleTest plug-in for Eclipse. Would you be willing to help test it?

    yours, Marcus
    Marcus Baker
    Testing: SimpleTest, Cgreen, Fakemail
    Other: Phemto dependency injector
    Books: PHP in Action, 97 things

  6. #6
    ********* Victim lastcraft's Avatar
    Join Date
    Apr 2003
    Location
    London
    Posts
    2,423
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hi...

    Quote Originally Posted by Captain Proton
    I wish PHP Eclipse would support it...
    There is an alpha version of an Eclipse plug-in on the SF site right now. It would be great if you could try it out...
    http://sourceforge.net/projects/simpletest/

    yours, Marcus
    Marcus Baker
    Testing: SimpleTest, Cgreen, Fakemail
    Other: Phemto dependency injector
    Books: PHP in Action, 97 things

  7. #7
    SitePoint Guru dbevfat's Avatar
    Join Date
    Dec 2004
    Location
    ljubljana, slovenia
    Posts
    684
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think it supports PHPUnit, there is a preference to set it's path ...

  8. #8
    ********* Victim lastcraft's Avatar
    Join Date
    Apr 2003
    Location
    London
    Posts
    2,423
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hi...

    Quote Originally Posted by jplush76
    I was curious if anyone out there might have some concrete examples of what might make SimpleTest superior to PHPUnit or if they really are just the same.
    They are essentially the same.

    PHPUnit has simple code coverage support and more flexible internals. SimpleTest has mock objects, but you can use the mocks with PHPUnit. SimpleTest has more precise type checking assertions as well. The main add on though is the web testing. There are othertools for that as well, but then you have to integrate them.

    I guess the main advantage of SimpleTest is that all ofthe main tools, unit testing, web testing and mock objects are in one package. If you are willing to work with separate components then I cannot advise porting all of your tests. It would be a lot of work for little gain. The main win is the act of doing unit testing at all. After that the choice of tool is secondary.

    yours, Marcus
    Marcus Baker
    Testing: SimpleTest, Cgreen, Fakemail
    Other: Phemto dependency injector
    Books: PHP in Action, 97 things

  9. #9
    SitePoint Wizard
    Join Date
    Aug 2004
    Location
    California
    Posts
    1,672
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have just been sent a SimpleTest plug-in for Eclipse. Would you be willing to help test it?
    I would.
    Christopher

  10. #10
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by arborint
    I would.
    So would I.

  11. #11
    SitePoint Guru
    Join Date
    Oct 2001
    Posts
    656
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have just been sent a SimpleTest plug-in for Eclipse. Would you be willing to help test it?
    Would love to

    I'm dying to get my hands dirty on some real world Java project (been doing a couple of practice projects at university).

  12. #12
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Simple Test.

    I'm a bit surprised actually, that there ever was a comparison

  13. #13
    SitePoint Zealot
    Join Date
    Jun 2004
    Location
    Bogota
    Posts
    101
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would like to see the plugin working to
    If I have wings, why am I walking?

  14. #14
    SitePoint Addict been's Avatar
    Join Date
    May 2002
    Location
    Gent, Belgium
    Posts
    284
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    SimpleTest, for the simple reason that I haven't tried PHPUnit.
    Veni, vidi and I kept using it (o boy is my latin rusty or what )

    Of the reasons Jason posted, I think 2, 3 and 4 are the important ones to me.
    I would not underestimate number 4 btw. This is a very nice community and Marcus' principle of "2 requests for the same feature and it goes on the todo list" is just awesome, it's not just words, he actually does this. It makes SimpleTest score very high on the "customer's satisfaction" - scale.
    User driven, one of the trademarks of a true XP'r


    I can imagine Eclipse-integration would be very nice, but not essential imho, I probably need to think this through more thoroughly, but for now, it seems like the only practical difference I can see is:
    - Eclipse - Junit: [CTRL-F11]
    - Editor - SimpleTest - browser: [ALT-TAB], [F5], [ALT-TAB]

    The rest is automation, whether that goes in an Ant build file, a make file, a DIY shell script doesn't really matter. I did say I probably need to think this through more thoroughly.
    Per
    Everything
    works on a PowerPoint slide

  15. #15
    ********* Victim lastcraft's Avatar
    Join Date
    Apr 2003
    Location
    London
    Posts
    2,423
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hi.

    I'll contact the author and see if I can pass the code on.

    yours, Marcus
    Marcus Baker
    Testing: SimpleTest, Cgreen, Fakemail
    Other: Phemto dependency injector
    Books: PHP in Action, 97 things

  16. #16
    SitePoint Guru
    Join Date
    Oct 2001
    Posts
    656
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'll contact the author and see if I can pass the code on.
    Cool, looking forward to it.

    Does anyone know if such a feature is too hard to implement?
    I am not that familiar with Eclipse's architecture (have been reading up on it though), but I think one could adapt the PHPUnit plugin for simpletest quite easily.

  17. #17
    SitePoint Evangelist jplush76's Avatar
    Join Date
    Nov 2003
    Location
    Los Angeles, CA
    Posts
    460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    does simpletest work with php5?
    My-Bic - Easiest AJAX/PHP Framework Around
    Now Debug PHP scripts with Firebug!

  18. #18
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jplush76
    does simpletest work with php5?
    Works fine. I use it with PHP5 every day here at work.

  19. #19
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So long as you don't use E_STRICT

  20. #20
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Using E_STRICT is fine for your code, just don't use it while you test your code with a PHP4 library.

  21. #21
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, you need (emphasis) to remove E_STRICT prior to writing tests, or things go pear shaped. If like me, your lazy, this can get tedious after a while

  22. #22
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just have whatever test fixture file you are using reset the error reporting before including the SimpleTest files, and again after any files in which you set it. Better off if you can refactor the E_STRICT setting in your own code to a bootstrab file which does not get called by the tests.

  23. #23
    Ribbit... Eric.Coleman's Avatar
    Join Date
    Jun 2001
    Location
    In your basement
    Posts
    1,268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've looked at both the documentation and code for simpletest and phpunit, and I am at a lost. I am totaly confused by this concept of "tests"

    Anywhere I can go to get a better understanding? I've read your introductions sweatje, and I still just cannot grasp the concept..

    - Eric
    Eric Coleman
    We're consentratin' on fallin' apart
    We were contenders, now throwin' the fight
    I just wanna believe, I just wanna believe in us

  24. #24
    SitePoint Guru BerislavLopac's Avatar
    Join Date
    Sep 2004
    Location
    Zagreb, Croatia
    Posts
    830
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Eric.Coleman
    I've looked at both the documentation and code for simpletest and phpunit, and I am at a lost. I am totaly confused by this concept of "tests"

    Anywhere I can go to get a better understanding? I've read your introductions sweatje, and I still just cannot grasp the concept..
    This is a quick breakdown:

    - you need a class/method to do some thing
    - you write down your expectations about the behavior, however silly they might seem (e.g. if I give the method x, it should return y; if this attribute is z and I call the method, that attribute will become w; if I pass a reference to an object of the class b to the method, it will throw th exception c; and so on)
    - using some testing framework (like those you mention), you write a short script that calls your code and asserts (through assertion functions) that the behavior is according to your expectations
    - this one applies if you go the TDD (test-driven development) road, i.e. if you write the tests *before* you write the code (which is a good practice): you run the test script, and all your tests fail (logically, because you wrote no code yet); then you write the code to make all tests suceed; when they do, you're done and repeat the process with another class/function.

    HTH

  25. #25
    ********* Victim lastcraft's Avatar
    Join Date
    Apr 2003
    Location
    London
    Posts
    2,423
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hi...

    Quote Originally Posted by Eric.Coleman
    I've looked at both the documentation and code for simpletest and phpunit, and I am at a lost. I am totaly confused by this concept of "tests"
    What piece of code, method or function, are you writing right now? I can explain more easily with a concrete example.

    yours, Marcus
    Marcus Baker
    Testing: SimpleTest, Cgreen, Fakemail
    Other: Phemto dependency injector
    Books: PHP in Action, 97 things


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •