Unit Testing. I just don’t get it.

I have tried and tried. I still don’t understand the use of unit tests.  I have seen a number of examples and tutorials about testing in AS3 and even more using iOS.

In every example its very simple tests so maybe I am just not seeing examples used in more complex code.

In almost every example its shown to test very basic values.   Every time I am thinking to my self  “No shit”.   Of course  “AssertTrue (5+5==10) * “.  If it didnt then we have a bigger issue with the computer.

Or things like   –   name = “bob”.   AssertTrue (name isEqualTo “frank”) *

I must be missing something. It seems like writing so much code to build mock objects and run these tests just to see “Tests Pass” pop up is a waste of time.

I am constantly checking to make sure the app or site works as I am building it. Is that the wrong way?  Do programmers sit and write 100s of lines of code and then publish and test? That just seems silly to me.

Maybe if you are working on a huge project with many team members it might be useful to know that someone else’s code works. And maybe thats where I am missing it. I have not worked on super large multi team programmer jobs. Everything I have done is either solo or with a few team members.  Some projects have been large but I always was testing along the way to make sure each method call was returning what I expected.

I am open to the idea of Unit tests. Like I said before I have tried many times to see where it would help out. I just have never seen or heard of any tutorials saying that its not worth it for small projects to do tests to make sure 1 + 1 == 2;

 

* yes I know these are not valid or even correct wording of the tests. I am using the idea of what it is to show an example.