30/10/2014 Chapter 8 Software Testing 1
30/10/2014 Chapter 8 Software Testing 1
Testing
• Development testing
• Test-driven development
• Release testing
• User testing
• Validation testing
• To demonstrate to the developer and the system customer that the
software meets its requirements
• A successful test shows that the system operates as intended.
• Defect testing
• To discover faults or defects in the software where its behaviour is
incorrect or not in conformance with its specification
• A successful test is a test that makes the system perform incorrectly
and so exposes a defect in the system.
• Verification:
"Are we building the product right”.
• The software should conform to its specification.
• Validation:
"Are we building the right product”.
• The software should do what the user really requires.
• Development testing includes all testing activities that are carried out
by the team developing the system.
• Unit testing, where individual program units or object classes are tested. Unit
testing should focus on testing the functionality of objects or methods.
• Component testing, where several individual units are integrated to create
composite components. Component testing should focus on testing
component interfaces.
• System testing, where some or all of the components in a system are
integrated and the system is tested as a whole. System testing should focus
on testing component interactions.
• A setup part, where you initialize the system with the test case,
namely the inputs and expected outputs.
• A call part, where you call the object or method to be tested.
• An assertion part where you compare the result of the call with the
expected result. If the assertion evaluates to true, the test has been
successful if false, then it has failed.
• The test cases should show that, when used as expected, the
component that you are testing does what it is supposed to do.
• If there are defects in the component, these should be revealed by
test cases.
• This leads to 2 types of unit test case:
• The first of these should reflect normal operation of a program and should
show that the component works as expected.
• The other kind of test case should be based on testing experience of where
common problems arise. It should use abnormal inputs to check that these
are properly processed and do not crash the component.
• Input data and output results often fall into different classes where
all members of a class are related.
• Each of these classes is an equivalence partition or domain where the
program behaves in an equivalent way for each class member.
• Test cases should be chosen from each partition.
• Choose inputs that force the system to generate all error messages
• Design inputs that cause input buffers to overflow
• Repeat the same input or series of inputs numerous times
• Force invalid outputs to be generated
• Force computation results to be too large or too small.
• Interface misuse
• A calling component calls another component and makes an error in
its use of its interface e.g. parameters in the wrong order.
• Interface misunderstanding
• A calling component embeds assumptions about the behaviour of the
called component which are incorrect.
• Timing errors
• The called and the calling component operate at different speeds and
out-of-date information is accessed.
• When testing software, you should try to ‘break’ the software by using
experience and guidelines to choose types of test case that have been
effective in discovering defects in other systems.
• Wherever possible, you should write automated tests. The tests are
embedded in a program that can be run every time a change is made to
a system.
• Test-first development is an approach to development where tests are
written before the code to be tested.