- COMP.CS.140
- 11. Functional Program
- 11.1 (Unit) Testing
(Unit) Testing¶
Learning Outcomes
On this round you will learn to understand the role of the software developer in software testing. We will first consider the basics of testing and get to know terminology. The we will focus on the programmer’s view to testing, i.e. unit testing. In addition you will learn to explain the challenges in testing and list the common testing practices used. Finally you will learn to attach the modern approach of continuous development as a part of testing.
Testing produces information on the software and the quality of the code to support decision making. Untested code is assumed to be broken in one way or another. Testing cannot prove that a program is error-free and always work correctly. Everything cannot be tested. Instead testing techniques are needed to build sufficient certainty on the quality of code.
Testing is not, at first hand, ensuring that the program works as it should work To ensure correct working is not a good starting point to design test cases, because human being can easily see those things that he/she wants to see
Testing is not limited to testing the defined functionality. Things tested include:
functional requirements: Answer the question what should the system do? Define the functionality of the software under development.
non-functional requirements: Answer the question what the system should be like? For example, it is safe to use, usable, easy to test, maintainable.
Testing can indicate that the program does something it should not do or vice versa that it doesn’t do something it should. Testing can also show that the program works against its requirements. In this case the question which one is wrong, the implementation or the requirement, needs to be addressed. Also detecting if the program is difficult to understand or use, is slow, or works in an unexpected way or incorrectly from the point of view of the user belongs under testing.
Testing is not, at first hand, ensuring that the program works as it should work. Ensuring correct working is a poor starting point to design test cases, because humans can easily see those things that they want to see. This applies especially to progrmmers testing their own code as they know how the program should work. Instead, the aim of testing it to releal errors in code. The starting assumption was that software code is incorrect in one way or another. The goal of testing is to find the errors. A successful test case is one that causes a failure in program execution.
Testing itself does not improve the quality of the software. Only removing the error from the code can achieve that. With the help of information collected through testing an opportunity to figure out what causes the errors. When the root cause of the errors can be sorted out, new ways of working can be implemented in software development to in part stop new errors from being created. In addition it is possible to reveal and manage so called technical debt.
Testing is hence measuring the quality of the software to gain a big picture of the state of software development and tgo support decision making. Unfortunately testing cannot show that the software is error free and neither does it improve software quality directly. Still it is an integral part of program implementation and the goal of software development is to achieve continuos knowledge on that possible errors in the implementation are also detected.