| Yifan Xu

Unit Test and Mocking

In this post, I will talk about how to write a unit test, what is mocking and why mocking is useful in unit test.


If you are a student like me, you might not be very familiar with unit test, or you are not used to writing one. In school work or small projects, unit test is not neccessarily needed either because you have your professors, TAs, or automated grading system to grade your final codes, or because you can easiliy debug your code once errors/exceptions occur. However, it’s super important, or mandatory when you are in a big project, where many components are working collaboratively. In fact, developing a habit of always writing unit test for your projects, regardless of how large it is, is a good practice in programming.

More contents will be written soon!