Testing
Black box testing
Black box testing is designed to test the functionality of software. For example:
- Does the program accept a number and return the square of the number?
- Does the program accept a Celsius value and return the Fahrenheit equivalent?
White box testing
White box testing is a method of testing software focusing on the internal structures or workings of an application, as opposed to just its functionality (which black boxA method of testing the functionality of an application without focusing on the internal workings testing can achieve).
white boxA method of testing the internal workings of an application as opposed to its functionality testing will focus on the structure of the code and will test every possible path through the code.
In the case of the example program converting Celsius to Fahrenheit, test caseA set of conditions to test a part of a computer program. would ensure the individual functions (add, sub, mul and div) work as expected.
Unit testing
A unit should be viewed as the smallest testable part of an application. As each new part of the system is completed, it is tested to make sure it works properly 鈥 if not, then other parts of the system that rely on it could fail.
In procedural programming, a unit could be a function 鈥 for example, the addition function in the code above.
In Object Orientated Programming (OOP)A programming paradigm based around the concepts of objects instead of just functions and procedures, a unit could be an methodIn computing, a method is a procedure that is executed in an object orientated programming language..
unit testingThe smallest testable part of an application or program is tested individually as its own module are completed on short 'snippets' of code. Unit tests are typically written and run by programmers to make sure that code meets its design and behaves as planned.
Integration testing
Integration testing takes modules that have been unit tested, groups them in larger sets of code and provides an integrated system (a system with modules working together) ready for system testing testing conducted on a complete system or entire program to ensure the system meets the user requirements.
For example, integration testing Individual software modules, functions and procedures are tested together would be carried out on the code below to determine if the add, mul and div functions can work together:
1 def tempCon(x):
2 return add(mul(x, div(9, 5)), 32)
Line 1 defines the function tempCon. A single value can be passed to this function.
Line 2 calls the divide function, passes the result to the multiply function, which in turn passes the result to the add function to be added to the value 32.
System testing
The purpose of a system test is to ensure that all the individually developed units of software work together as intended.
A benefit of system testing testing conducted on a complete system or entire program to ensure the system meets the user requirements is that it helps you discover problems or inconsistencies between the programmed modules, libraries and functions intended to work together.
For example, once all the functionality of the calculator has been completed, it would be tested as an entire system.