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.

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 ;)

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.