Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is unit testing, and does it require code being written?

I've joined a new team, and I've had a problem understanding how they are doing unit tests. When I asked where the unit tests are written, they explained they don't do their unit tests that way.

They explained that what they're calling unit tests is when they actually check the code they wrote locally, and that all of the points are being connected. To me, this is integration testing and just testing your code locally.

I was under the impression that unit tests are code written to verify behavior in a small section of a code. For example, you may write a unit test to make sure it returns the right value, and make the appropriate calls to the database. use a framework like NUnit or MbUnit to help you out in your assertions.

Unit testing to me is supposed to be fast and quick. To me, you want these so you can automate it, and have a huge suite of tests for your application to make sure that it behaves AS YOU EXPECT.

Can someone provide clarification in my or their misunderstandings?

like image 375
Larry Gasik Avatar asked Nov 29 '22 17:11

Larry Gasik


1 Answers

I have worked places that did testing that way and called it unit testing. It reminded me of a quote attributed to Abe Lincoln:

Lincoln: How many legs does a dog have?

Other Guy: 4.

Lincoln: What if we called the tail a leg?

Other Guy: Well, then it would have 5.

Lincoln: No, the answer is still 4. Calling a tail a leg doesn't make it so.

like image 170
Kane Avatar answered Dec 06 '22 19:12

Kane