Jump to content

php unit testing, practical uses in small projects?


Anti-Moronic

Recommended Posts

I must confess, I've not really done much unit testing at all in the last 3 years. Can anyone give me an idea of what they would test and why that would be faster or more efficient than running the code as a user?

 

One area I can see it having huge benefits is when I'm testing methods which interact with a database, like user registration, which I would probably test by registering several times - fixing any bugs, making amendments and repeating. Ok, so I kinda sold the idea to myself there :)

 

But, what about for small applications? I've seen people testing whether a variable is countable...why would I not just check the output immediately?

 

Appreciate any advice.

Link to comment
Share on other sites

Deciding whether or not to Unit-Test does not depend on the size of the application but rather on the risk/value of the application. You can have a tiny application that transfers funds from the client to your bank account, you don't want anything to go wrong there, do you?

 

In short apply Unit-Testing for high-risk and/or high-value software. Unit-Testing is like a bug-spray it doesn't guarantee you killed all bugs but the annoyance will be far less ;)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.