To ensure every line of code executes correctly is recommender to use Unit Testing, Unit Testing is the process of testing each unit of code in a single component. One unit is the smallest part in a software, one unit can be a single program or function.
To ensure every function produces its expected outcome developers have to use Functional Testing. Functional testing indicates concerns about the correct decision of functional requirements. Functional testing is like a black box testing which don’t require any knowledge of the underlying implementation.
To ensure that all of the functions combine to deliver the desired business results developers have to use System testing. This type of testing executes end to end functional tests that can cross software units, in order to help become fully aware of the goals of assure that components deliver the desired business results.
To ensure new changes did not adversely affect other parts of the system developers should use Regression testing. Regression testing is used to ensure code modifications that have not accidentally introduced bugs into the system. When using Regression testing is recommended to include plans from the original unit and system tests phases which can show that existing functionality behaves as planed.
I wrote in my previous blogs posts about these four of these functional tests i really recommend you to read my previous posts because there you can find dip details about unit testing and etc.
Citation
http://searchsoftwarequality.techtarget.com/report/Six-functional-tests-to-ensure-software-quality
From the blog Table of Code by Andon S and used with permission of the author. All other rights reserved by the author.