Testing
Testing
Testing
Note:
Faults or bugs in a program are then exposed at the testing stage.
Testing will show the presence of faults to be corrected, but cannot guarantee that large,
complex programs are fault free under all circumstances.
Faults can appear during the lifetime of a program and may be exposed during live
running.
The faults are then corrected as part of the maintenance stage of the program lifecycle
The above shows an example of a syntax error being found, and the IDE offering a
possible reason for the error.
Many IDEs will offer suggestions about what syntax errors are and how to correct them.
Mistyping or misspelled a reserved word such as writing PLINT instead on PRINT. Such
errors cause a halt in the translation process
not closing an opened bracket e.g y = 10 / (2+
no THEN keyword used in visual basic in IF statements e.g IF x > 10
using NEXT without FOR
2. Logic errors
Logic error is a mistake in the structure of a program (mistake occurs because the
algorithm on which the code is based is faulty) e.g using + instead of –
An error in the algorithm that causes the program not to behave as intended
This programming error is not detected by the computer but can only be identified
through the results the program produces.
Error messages are not produced.
Examples:
Writing Net salary = Gross pay + Deductions instead of
Net salary = Gross pay - Deductions
Other examples:
having 3 iterations instead of 4
jump to a wrong point in the program
Consequently, such errors do not halt the translation process
When and how logic errors are identified?
When: when unexpected results occur
How: Using tools such as a trace table// dry run // white box
Trace tables show the process of dry-running a program with columns showing the values of
each variable as it changes.
Note:
Programs need to be rigorously tested before they are released.
There needs to be a test strategy set out in the analysis stage of the program development
lifecycle showing an overview of the testing required to meet the requirements specified.
This shows how and when the program is to be tested.
In order to clarify what tests need to be performed, a test plan is drawn up showing all the
stages of testing and every test that will be performed.
As the testing is carried out, the results of the tests can be added to the plan showing that
the program has met its requirements.
There are several formal methods of testing used to ensure that a program is robust and
works to the standard required. Although there is a testing stage in the program
development lifecycle, testing in some form occurs at every stage, from design to
maintenance.
Methods of testing
Dry run: in which the developer works through a program or module from a program manually
and documents the results using a trace table.
Walkthrough:
A formalised version of a dry run using pre-defined test cases.
This is where another member of the development team independently dry runs the
pseudocode, or the developer takes the team members through the dry run process.
This is often done as a demonstration.
During the program development and testing, each module is tested as set out in the test
plan. Test plans are often set out as a table; an example for the calculation procedure is
shown below.
Types of testing
White box testing
It is the detailed testing of how each procedure works.
It involves testing the structure and logic of every path through a program module.
Black box testing
involves checking whether the output is as expected for a given input without knowing
the code (check if expected data = actual data).
Note:
A software testing technique whereby the internal workings of the item being tested are
not known by the tester.
For example, in a black box test on a software design the tester only knows the inputs and
what the expected outcomes should be and not how the program arrives at those outputs.
The tester does not ever examine the programming code and does not need any further
knowledge of the program other than its specifications.
Integration testing
Testing of any separately written modules to ensure that they work together during the
testing phase of the program development lifecycle.
If any of the modules have not been written yet, stub testing can be included which
makes use of dummy modules for testing purposes.