SitePoint Sponsor

User Tag List

Page 1 of 4 1234 LastLast
Results 1 to 25 of 80
  1. #1
    SitePoint Wizard
    Join Date
    Dec 2004
    Location
    USA
    Posts
    1,407
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How many actually use unit testing?

    I am curious how many developers actually use it.

    If so, what program do you use to help test?

  2. #2
    Sell crazy someplace else markl999's Avatar
    Join Date
    Aug 2003
    Location
    Manchester, UK
    Posts
    4,007
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I use Simple Test.
    That page also has decent examples of how to use it.
    http://www.phppatterns.com/index.php...leview/33/1/2/ is worth a read too.

  3. #3
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thread moved. This question is more suited to this forum

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  4. #4
    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)
    Every day. SimpleTest
    Jason Sweat ZCE - jsweat_php@yahoo.com
    Book: PHP Patterns
    Good Stuff: SimpleTest PHPUnit FireFox ADOdb YUI
    Detestable (adjective): software that isn't testable.

  5. #5
    SitePoint Zealot
    Join Date
    Mar 2004
    Location
    netherlands
    Posts
    104
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, with simpletest

  6. #6
    SitePoint Guru
    Join Date
    Oct 2001
    Posts
    656
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I use it (SimpleTest) on my current project. Loving it

    I still write most of my tests after I have coded a unit, though, instead of doing test driven development. Even so, I have already cougt a handful of wouldbe-bugs before they can really cause trouble.

    That's the thing I like about it, the added sense of security and knowing that your code really does do what it's intended to do.

  7. #7
    SitePoint Addict been's Avatar
    Join Date
    May 2002
    Location
    Gent, Belgium
    Posts
    284
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A SimpleTest a day keeps the doctor away
    Per
    Everything
    works on a PowerPoint slide

  8. #8
    SitePoint Addict
    Join Date
    Oct 2004
    Location
    Brooklyn, NY
    Posts
    359
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think I'm in the minority among PHP developers, but I prefer Apache-Test.

    Unlike Simple Test and PHPUnit, it's not just something to help you write your tests, although it does make that pretty easy (whether you're writing procedural or object-oriented code). It's a complete testing framework for the Apache web server. In fact, it's the official testing framework, and it's maintained by the Apache Software Foundation. It's very mature and being used by some really big sites, and it's had PHP support for about a year now.

    I'm not sure whether the average PHP developer would feel comfortable using it. Its userbase has traditionally been C, Perl, and mod_perl developers writing Apache modules, web applications that utilize many of the Apache API's hooks, etc. These people are comfortable on a command line and are writing some pretty complex code that needs the level of testing purity provided by Apache-Test.

    I think there are plenty of PHP developers who are just as "hardcore," but I think we might be in the minority.

    Just in case I'm wrong, I've been writing a series of articles for PHP Magazine about testing PHP using Apache-Test. I also gave a talk about it at last year's ApacheCon, and I might be giving a talk on it at this year's ApacheCon Europe (if I'm accepted).

    I'd be very curious to know whether any other PHP developers are using this.
    Chris Shiflett
    http://shiflett.org/

  9. #9
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A SimpleTest a day keeps the doctor away
    Hey, I heard that...

    I like Unit Testing as well though I don't use it on a regular basis so I'm interested in seeing where this thread goes so I can benifit

  10. #10
    ********* 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 shiflett
    I'd be very curious to know whether any other PHP developers are using this.
    Could you show us a sample test snippet?

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

  11. #11
    SitePoint Zealot sike's Avatar
    Join Date
    Oct 2002
    Posts
    174
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i use simpletest for my latest project. loving it

  12. #12
    SitePoint Zealot
    Join Date
    Oct 2004
    Location
    naperville
    Posts
    189
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I too use and love simpletest

  13. #13
    simple tester McGruff's Avatar
    Join Date
    Sep 2003
    Location
    Glasgow
    Posts
    1,690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    SimpleTest. It's the only one with mock objects AFAIK.

    Testing is a highly contagious virus and I never want to be cured.

  14. #14
    SitePoint Zealot
    Join Date
    Mar 2004
    Location
    Australia
    Posts
    101
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Unit testing is an execellent process, it provides a degree of comfort that if you change some code and if the test runs OK, the system will most likely be alright. This become important in a large code base and with multiple developers.

  15. #15
    SitePoint Addict
    Join Date
    Oct 2004
    Location
    Brooklyn, NY
    Posts
    359
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could you show us a sample test snippet?
    I can do better than that. There is a complete Apache-Test demo available here:

    http://shiflett.org/apache-test-demo.tar.gz

    It contains a very simple example PHP application, some example tests, and a bit of documentation. The tests all use the embedded test-more.php library (which has the same syntax as Test::More), but I've been thinking that it would be very easy to make Simple Test and PHPUnit work in this environment. The framework itself is what makes Apache-Test so great.

    The embedded test-more.php library just makes writing tests really easy. The idea was to mimic Test::More, because this is what made testing in the Perl community so fashionable. And, I must admit, the Perl community is still years ahead of the PHP community when it comes to testing.
    Chris Shiflett
    http://shiflett.org/

  16. #16
    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)

  17. #17
    SitePoint Addict
    Join Date
    Oct 2004
    Location
    Brooklyn, NY
    Posts
    359
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://shiflett.org/apache-test-demo.tar.gz

    Sorry, I guess I have .php on the brain. :-)
    Chris Shiflett
    http://shiflett.org/

  18. #18
    simple tester McGruff's Avatar
    Join Date
    Sep 2003
    Location
    Glasgow
    Posts
    1,690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi - link redirects to http://shiflett.org but I found a couple of articles there:
    http://shiflett.org/archive/80
    http://shiflett.org/archive/92

    Are these the ones?

    Edit: ignore - I didn't see last couple of posts.

  19. #19
    simple tester McGruff's Avatar
    Join Date
    Sep 2003
    Location
    Glasgow
    Posts
    1,690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Would I be correct in thinking that mock objects and expectations are not available with apache-test?

    PS: maybe we should start a new topic for apache-test?

  20. #20
    ********* 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 shiflett
    The tests all use the embedded test-more.php library (which has the same syntax as Test::More), but I've been thinking that it would be very easy to make Simple Test and PHPUnit work in this environment.
    Would you be willing to help with getting SimpeTest working with Apache-test? I know you are woking on a book, but I thought I would ask just in case .

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

  21. #21
    SitePoint Addict
    Join Date
    Oct 2004
    Location
    Brooklyn, NY
    Posts
    359
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by lastcraft
    Would you be willing to help with getting SimpeTest working with Apache-test? I know you are woking on a book, but I thought I would ask just in case .
    Sure. :-)

    I am actually very happy to see that so many PHP developers test, and I'm eager to do anything I can do to help promote that.

    I knew about Simple Test, PHPUnit, and the .phpt tests (which seem inspired by the .t tests that Apache-Test and many other testing utilities use), but I didn't know which one PHP developers used the most or even whether there were many PHP developers who tested at all. So, I chose to implement a PHP equivalent of Test::More, since I already had a large audience for that.

    This topic makes me think that Simple Test is pretty popular, too. :-)
    Chris Shiflett
    http://shiflett.org/

  22. #22
    ********* 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 shiflett
    Sure. :-)
    Yippee! send me a mail.

    Quote Originally Posted by shiflett
    I am actually very happy to see that so many PHP developers test, and I'm eager to do anything I can do to help promote that.
    That was my motivation as well .

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

  23. #23
    If it aint Dutch it aint much Kilroy's Avatar
    Join Date
    Oct 2003
    Location
    The Netherlands
    Posts
    406
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You're going to kill me for this - what's the point of unit testing? If I want to know whether or not my application does certain things I'll test it by hand. I would presume this is a lot faster than doing it with unit tests. If anyone could enlighten me why I should do unit testing, by all means please do.

  24. #24
    SitePoint Wizard
    Join Date
    May 2003
    Location
    Berlin, Germany
    Posts
    1,829
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, once used SimpleTest, but the effort involved for me at that time was quite too much, since I was not used to OOP and always had a complete imperative approach. Thus, my test code was sometimes as long as the normal application code.

    Since I was quite good at testing-by-hand I didn't used SimpleTest anymore. Me thinks that now with my improved OOP knowledge I should try it out again.

  25. #25
    If it aint Dutch it aint much Kilroy's Avatar
    Join Date
    Oct 2003
    Location
    The Netherlands
    Posts
    406
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My OOP knowledge is sufficient, that's not going to be the problem, I just think I will be forever busy writing test cases that I can test out by hand ten times as fast.


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
  •