Unit Testing Phrases

Unit Testing Phrases

When we begin our journey doing Unit Testing and look at some articles or books, we usually end with a WTF in our mind.  Books and articles give us some phrases or wording that we do not understand.  I will try to throw you some of those phrases with a little more simple explanation.

Black Box Testing

Black box testing is the test you do to a piece of code and you do not know the internals of the code.  You only know that the method will receive some inputs and will return or do something.  How it will do it is not your concern.  Think like you are testing the PadLeft method of the .Net Framework.  You don’t know the internals, but you know how will be the end result of using it.

White Box Testing

The opposite of the Black box testing is the White box testing.  In this type of testing you know the internals of the code, then all your tests can take advantage of it.  If you know all the if statements of your code under test, then you can test all the path of the code. if statements path.  If your want, you could also use this advantage to make Code Coverage test to your code.

Boundary Test

Boundary test is a term used to explain how we can test our inputs against a method under test.  Suppose you have a method that will take an integer as an input parameter. It will return true if the integer is between 10 to 15; otherwise it will return false.  We test the method passing 9, 10, 11, 12,13, 14, 15 and 16, and any other random number for the sake of.  But what happened if the same method will return true if our input is from 10 to 1,000,000.  Are we going to do one million test cases?

Boundary testing use the boundary of the possible input list in consideration.  In our latest case, it will be reasonable to test the following inputs 9, 10 and 11 for the lower boundary. So, we can use 999999, 1000000, and 1000001 for the upper boundary.

These are the most typical phrases using in Unit Testing.  Other words will come in a future article.

Rodnney

I am a "multi hat" software developer with more than 18 years in experience. I had worked from government agencies, insurance companies, ticketing system and educational business using a lot of technologies like SQL Server, Oracle, ASP.NET, MVC, HTML, CSS, Javascript, Linq, etc.

You may also like...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.