[Unit Testing] Getting Started with Unit Testing
Unit Testing: Is a software development process in which the smallest testable parts of an application are individually and independently tested . Simply verifies that individual units of code (mostly functions) work as expected. Is a component of test-driven development (TDD). Usually performed by the developer. Performed using White Box Testing method. Is meant to give the developer more confidence and trust in the code. Encourages modularity - write programs that do one thing, and do it well! (Single Responsibility Principal) Involves faking dependencies and methods in order to isolate the scope of the System Under Test (SUT) Simple Example The most simple example is testing the result of a method is within our expectation. For example, we we have a combineNumbers method below: To test this, we simply compare the result of this method with our expected result. When you run the tests, you will be informed that these tests have passed. When to do Unit