Testing is software engineering is a method of providing information about code quality when developing a piece of software. The intent of writing and running tests is the enforce good software design and identify software bugs and defects. These defects can include specification/requirement errors as well as developer mistakes.
The general aim of software testing is the ensure that software meets the following goals,
Meets its requirements gathered before its design and implementation
That it responds correctly to the appropriate inputs
Is usable such that it performs tasks in time and can be run in the appropriate settings
Achieves the end goals for the stakeholders
There are many different types of software testing including but not limited to, A/B, Acceptance, Alpha, Beta, Compatibility, Development, Functional, Performance, Regression, Security, Smoke and Usability. All of which can be used individually or together to help achieve the above goals.
Software testing can prove a given piece of software to be correct under certain assumptions. However it is worth keeping in mind that the total number of combinations of inputs to any simple product is enormous and as such is is unlikely that testing will be able to find every possible defect. It has been estimated however that the estimated cost of software bugs could be reduced by a third if proper software testing was implemented [NIST The Economic Impacts of Inadequate Infrastructure for Software Testing].