1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

php testing software?

Discussion in 'PHP' started by Questionmark, Feb 11, 2008.

  1. #1
    i need to know what software is used for php testing?
    as jtest is used for java
    please please help me
     
    Questionmark, Feb 11, 2008 IP
  2. projectshifter

    projectshifter Peon

    Messages:
    394
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I have no idea what you're talking about... testing software? As in debugging perhaps? If that's what you mean, it's called ini_set('display_errors', 'On');
     
    projectshifter, Feb 11, 2008 IP
  3. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Seriously? That's not debugging at all... if you want debugging, look into actually using an IDE that integrates with any of the debug extensions out there (Eclipse PDT with Zend debug or XDebug, for example).

    As for testing: are you talking about automated, scripted testing of PHP sites? If so, look into Selenium from openqa.org (not that that is for PHP specifically, but it does client side web site testing).
     
    TwistMyArm, Feb 11, 2008 IP
  4. projectshifter

    projectshifter Peon

    Messages:
    394
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #4
    This isn't Java, or C or ASM, this is PHP. If you can't figure out what's wrong from the PHP errors, you seriously just need to spend more time coding it. I was being sarcastic about enabling errors, but it's more than enough of a debugger you could ever need for PHP. If you seriously have to setup an external debugger because you can't figure out what the PHP error codes mean... you need to either find another profession or get in a lot more practice. I can take a look at an error code and determine what it's saying, you get used to this stuff.
     
    projectshifter, Feb 11, 2008 IP
  5. Brewster

    Brewster Active Member

    Messages:
    489
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    60
    #5
    Brewster, Feb 11, 2008 IP
  6. walkere

    walkere Active Member

    Messages:
    112
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    58
    #6
    Agreed.

    Between a syntax highlighting editing program and display_errors, you should have plenty of debugging/error checking. A fatal PHP error is usually pretty specific about what's going wrong.

    I also set up a local php server on my machine so I can execute the script and test its functionality.

    - Walkere
     
    walkere, Feb 11, 2008 IP
  7. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #7
    What error code does PHP give you when you have a logic error? Which error setting do I need to use so that it will tell me when the library of code that I'm using from a third party has an off-by-one error in one of it's for loops?

    It's funny that you say "This isn't Java, or C or ASM, this is PHP" because debuggers aren't about the language... this is software engineering and you must be a genius to write all that PHP code without a single logical error... I don't know about you, but when I'm working in a team of a dozen coders on a PHP project that spans 100s of code files across multiple directories, it sure does help to be able to dump a break point in the middle there at times.
     
    TwistMyArm, Feb 11, 2008 IP
  8. Danny

    Danny Active Member

    Messages:
    732
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    78
    #8
    I have to agree with TwistMyArm on this one.

    Sure for simplistic errors PHP returns adequate errors. However it does not at all allow proper testing and debugging.

    I can only assume that "projectshifter" has only developed for small sites or individual use and never developed for a product or in a team development environment, where break points at a minimum really help you get through the code.

    Fact is PHP errors are there as a guide but do not allow for proper and correct debugging of an application.

    grrr kiddies!
     
    Danny, Feb 11, 2008 IP
  9. projectshifter

    projectshifter Peon

    Messages:
    394
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #9
    It's called die('DEBUG #1'); "FATAL ERROR: <reason> @ LINE #<#>" It's pretty specific. If you have a logic error... in a PHP file... you really need to spend a lot more time thinking before you write it.
     
    projectshifter, Feb 11, 2008 IP
  10. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #10
    You say 'in a PHP file' like PHP is this special language... I don't get it.

    You seem to imply that debuggers are good for all other languages but PHP, and that 'die with some text' is good enough for PHP. Does that mean that 'sprintf("something"); return 1;' is a valid way to deal with errors in a C application?

    If not, what makes it valid for one language but not the other? I really believe that you need to explain the reasoning for this thinking.

    Dare I also say that dies may be 'fine' for your code, but do you expect me to go and write them all through the JPGraph library, for example, for when I have problems with it?
     
    TwistMyArm, Feb 11, 2008 IP
  11. projectshifter

    projectshifter Peon

    Messages:
    394
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #11
    OMG you baby, calm down. PHP is not that hard, and you never write extremely complex systems anywhere near what you encounter in compiled languages. Get over it, it isn't that hard, so yeah I'm saying that you don't need to have some big system that interprets if you weren't capable of writing a small php application with some forethought.
     
    projectshifter, Feb 11, 2008 IP
  12. Cyrus_vtn

    Cyrus_vtn Peon

    Messages:
    102
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #12
    one of the reasons i like php :)
     
    Cyrus_vtn, Feb 11, 2008 IP
  13. blueparukia

    blueparukia Well-Known Member

    Messages:
    1,564
    Likes Received:
    71
    Best Answers:
    7
    Trophy Points:
    160
    #13
    Same. AFAIK I have never gotten a logic error either - even in some big applications
     
    blueparukia, Feb 11, 2008 IP
  14. coolfluke

    coolfluke Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    try to wamp server please. I using it. Very good php testing server. !
     
    coolfluke, Feb 11, 2008 IP
  15. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #15
    Firstly, calling me a baby it's pretty weak, man.

    Now maybe *you* don't write complex PHP applications, but many do, every day. What do you consider complex? My example of a dozen coders with hundreds of files... would that not be considered complex? Is that a kind of system that you could do without any logical errors, KNOWING that the rest of the team can't make any logical errors, either? That is the kind of project I am working on RIGHT NOW.

    Ignoring what you and I do: are you telling me that you could write an entire CMS without a logical error, or do you consider something like Joomla or Drupal not a complex system?

    Could you write the JPGraph library without a logical error or again, is it not complex? I take that example to heart because I personally converted JPGraph to output SVG (which is entirely different to any other image format supported by JPGraph, mainly because it's all client side) and I KNOW that a debugger was a God-send in that instance.

    If you can do those sorts of libraries and systems without any logical errors, I bow to your abilities... but like I say, when you say "you never write extremely complex systems anywhere near what you encounter in compiled languages" you are entirely wrong because let's face it, you have no idea what kinds of systems I do in PHP, and I can guarantee you that some of the stuff I do in PHP dwarfs a number of compiled, off the shelf projects that I have worked on.

    So just so that we all know... what size of a PHP project do you consider 'large and complex' that still does not require a debugger?
     
    TwistMyArm, Feb 12, 2008 IP
  16. dwayne12

    dwayne12 Well-Known Member

    Messages:
    184
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    110
    #16
    Wow a debate over PHP debugging.

    Being a professional PHP developer for a few years now in my experience you don't need a fancy IDE like Zend or Eclipse PDT to debug your scripts. IDE's are good for one thing, keeping track of your projects files and keeping everything organised.

    If you need an IDE / Debugger to work out a problem in your PHP scripts I think personally it's a waste of time. Setting up a debugger isn't for the faint hearted. Ever try to get Eclipse PDT working with XAMPP under windows? Talk about nightmare.

    All you need to do is download a copy of XAMPP install it, copy your script over to the htdocs folder execute it and if there is an error it will tell you so. I've never come across an error in PHP that couldn't be displayed via a web browser and needed a debugger to tell me what the real problem was. Even professional PHP developers make mistakes of course they do, but how often does a PHP developer make a mistake he needs a debugger to fix it? Most PHP problems are missing semi-colons anyways.

    Apache gives you more than enough information when there is something wrong with a PHP script, a debugger is overkill unless you are working on some massive Secure Bank Application or something. Also I don't think a CMS is a huge project at all, try coding your own PHP framework or something that's a big project.

    I seriously doubt you are working on big major complex PHP projects that contain hundreds of class files and hundreds and thousands of complex PHP statements and lines.

    PS. Java isn't some easy to learn language you can just pick up straight away like PHP. Java is more prone to serious errors and thus a debugger for Java makes more sense to me than it does for PHP. You can't even compare Java to PHP.

    - Dwayne Charrington.
     
    dwayne12, Feb 12, 2008 IP
  17. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #17
    Firstly, I said hundreds of files, not hundreds of class files.

    Secondly, even if you doubt what I do (it's your prerogative), do you deny that there are code bases out there that size?

    Every argument against debugging so far has essentially been "I don't believe that you work on a project big enough to warrant it". That doesn't fly because even if you don't believe that I do work on them, you have to also argue that no project that size exists. You're arguing against what I say I do, not what I say exists.

    Tell me that you don't believe that any PHP project warrants a debugger and then at least we are on the same page. I'll argue with you on that, I'm not going to bother trying to prove to you what I work on.
     
    TwistMyArm, Feb 12, 2008 IP
  18. mlkshake

    mlkshake Peon

    Messages:
    73
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #18
    I've been watching this thread since it started and it just keeps going back and forth. Each person can have their own opinion but arguing about it in someone elses thread is just pointless. Both sides have given good answers to Questionmark's question and it should be left at just that. If you want to argue about what type of testing/debugging should be used then I suggest that you guys make a thread for it. Thats just my 2 cents.
     
    mlkshake, Feb 12, 2008 IP
  19. phpl33t

    phpl33t Banned

    Messages:
    456
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    0
    #19
    Testing:

    1 turn error reporting to 2047
    2 go through and do everything imaginable on your software until not one error, notice, or warning shows. Even notices show for a reason, a bad reason.

    not that complicated.
     
    phpl33t, Feb 12, 2008 IP
  20. projectshifter

    projectshifter Peon

    Messages:
    394
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #20
    Totally agreed (but I hate notices :p)



    lol I'm not really sure what you're trying to accomplish here. I've written huge CMS systems, 70k lines of code (actual lines, no spaces) for the first draft of it. I've also written complicated RSS and website parsers, as well as actual server programs that operate a game and interact with an application written in delphi (I was bored). If you can find that many more complex applications of PHP, I really urge you to explore using other languages as an option. What half of us here are saying, is that if you're working on it with a lot of other people, having some kind of cooperation system is fine, but it's really not that hard to figure out what the PHP errors are, and I don't think I've ever had too many "logical" errors that were hard to find or fix.
     
    projectshifter, Feb 12, 2008 IP