Please let me know how do we effectively and quickly test a php code ?
What is the best way to debug/test a PHP code ?
Collapse
This topic is closed.
X
X
-
sudeerao@gmail.comTags: None -
Erwin Moller
Re: What is the best way to debug/test a PHP code ?
sudeerao@gmail. com wrote:
Short question.Please let me know how do we effectively and quickly test a php code ?
Difficult to answer.
It completely depends on your requirements.
You can judge the code by:
- security (header/email-injection, sql-injection, loginlogic)
- functionality: Does the code produce what you want, also if you feed it
information designed to confuse it.
- Codingstyle: Can a PHP programmer easily read through the code? Does it
have some comments to explain what is going on? If you use a database, is
it designed neat and smart?
- stresstesting: Do you expect a lot a concurent hits, and is the setup on
your machine capable of handling that? (Of course it is up to you to set
the minimum)
etc.
So what is it you want?
I think it is safe to say you need an experienced PHP programmer to judge
any of the above (except the stresstesting maybe).
Regards,
Erwin Moller
-
Peter Fox
Re: What is the best way to debug/test a PHP code ?
Following on from Erwin Moller's message. . .Yes. "debug" and "test" are entirely different things.>sudeerao@gmail .com wrote:
>>>Please let me know how do we effectively and quickly test a php code ?
>Short question.
>Difficult to answer.
>
>It completely depends on your requirements.
>You can judge the code by:
>- security (header/email-injection, sql-injection, loginlogic)
>- functionality: Does the code produce what you want, also if you feed it
>information designed to confuse it.
>- Codingstyle: Can a PHP programmer easily read through the code? Does it
>have some comments to explain what is going on? If you use a database, is
>it designed neat and smart?
>- stresstesting: Do you expect a lot a concurent hits, and is the setup on
>your machine capable of handling that? (Of course it is up to you to set
>the minimum)
>
>etc.
>
>So what is it you want?
>
>I think it is safe to say you need an experienced PHP programmer to judge
>any of the above (except the stresstesting maybe).
>
>Regards,
>Erwin Moller
Debug : Getting rid of reported faults
Exercise : Run all bits of code and show it can be made to work
Test : Look for weaknesses.
If you're wondering how to find out what's going on inside your program
when you get a run-time problem then you might simply put in a
print_r(), or write a log of function calls, variable watches etc to
another file. [My PHP system is off-line at the minute or you could
have my debugging library]
FWIW the way to develop Exercise and Test is by making notes as you're
building the code: What could possibly go wrong?... Silly
arguments...fla g this for future investigation to stop interrupting flow
of coding thought...is that a [D] for document a [E] for exercise or a
[T] for needs testing (or all of them). Then when you're setting out to
exercise you look for "[E] comments " in the code and build the
exercises accordingly. And so on.
PS Personally I don't care much for black box testing if the white box
(stupid name) has been done well.
--
PETER FOX Not the same since the deckchair business folded
peterfox@eminen t.demon.co.uk.n ot.this.bit.no. html
2 Tees Close, Witham, Essex.
Gravity beer in Essex <http://www.eminent.dem on.co.uk>
Comment
-
Jerry Stuckle
Re: What is the best way to debug/test a PHP code ?
sudeerao@gmail. com wrote:There have been whole volumes written about testing code and codePlease let me know how do we effectively and quickly test a php code ?
>
quality. It's not at all a simple question. Larger programming
departments have entire groups of people dedicated to test and quality
control.
As a short answer, you test code with valid data to ensure it does what
you want. Then you test it with invalid data to ensure it properly
handles the bad input. And when you make changes, you repeat the
process to ensure you haven't regressed anything.
Test scripts help a lot. But to use them the code must be well
documented and its purpose clear.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attgl obal.net
=============== ===
Comment
-
countach
Re: What is the best way to debug/test a PHP code ?
En las nuevas, el sudeerao@gmail. com escribió:Run it and see if it works.Please let me know how do we effectively and quickly test a php code ?
Comment
-
Tom
Re: What is the best way to debug/test a PHP code ?
This is more related to debugging, but one thing I found very helpful
was writing my own error-handler so that it provided a trace when an
error did occur. This page is helpful:
Also, someone mentioned print_r(). I wrote my own function that
basically does this, except formats the output more nicely and provides
a function and file trace.
If your code is more object-oriented, then unit-testing would a good
term to research.
Tom
On Nov 28, 12:49 am, "sudee...@gmail .com" <sudee...@gmail .comwrote:Please let me know how do we effectively and quickly test a php code ?Comment
Comment