KEMBAR78
12.4 Program Testing Maintenance EMK Notes | PDF | Software Testing | Programming
0% found this document useful (0 votes)
92 views5 pages

12.4 Program Testing Maintenance EMK Notes

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views5 pages

12.4 Program Testing Maintenance EMK Notes

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

12.

4 Program Testing & Maintenance

Objective:
 Show understanding of ways of exposing and avoiding paperscambridge.com
faults in programs.
 Locate and identify different types of errors e.g syntax errors, logic errors, run-time errors
 Show understanding of methods of testing available and select appropriate data for given
Method Including dry run, walkthrough, white-box, black-box, integration, alpha, beta,
acceptance, stub.
 Show understanding of the need for a test strategy test plan and their likely contents.
 Choose appropriate test data Including normal, abnormal and extreme/boundary.
 Show understanding of need for continuing maintenance of a system and differences between
each type of maintenance.
 Analyse an existing program and make amendments.
 to enhance functionality
Ways of Avoiding and Exposing faults in Programs
Most programs written will contain errors, as programmers are human and do make
mistakes.
A program fault is something that makes program not do what it is supposed to do
under certain circumstances. Faults in executable program are frequently faults in
design of program.
Debugging is process of finding and correcting errors (bugs) in a program. An IDE
contains features to help with debugging.
Fault avoidance starts with provision of comprehensive and rigorous program
specification at end of analysis phase of program development lifecycle, followed by
use of formal methods such as structure charts, state-transition diagrams and
pseudocode at design stage.
At coding stage, use of programming disciplines such as information hiding,
encapsulation and exception handling, all help to prevent faults.
Faults or bugs in a program are then exposed at testing stage. Testing will show
presence of faults to be corrected, but cannot guarantee that programs are fault free
under all circumstances. Faults can appear during lifetime of a program and may be
exposed during live running. Faults are then corrected as part of maintenance stage of
program lifecycle.
Types of Errors
 Syntax errors are errors in grammar of a source program. Syntax error in which a
program statement does not follow rules of programming language e.g. incorrect
spelling of a keyword. In coding phase of program development lifecycle, syntax of
program is checked, and errors need to be corrected before program can be
executed.
IDEs offer suggestions about what syntax errors are and how to correct them.

Computer Science IGCSE, O & A level By Engr M Kashif 03345606716


12.4 Program Testing & Maintenance

 Logic errors are errors in logic of a program, meaning program does not do what it is
supposed to do. These errors are usually found whenpaperscambridge.com
program is being tested.
IDEs allow us to single step through a program to find errors.
We can also work through a program to check that it works as it should, using trace
table. Trace tables show process of dry-running a program with columns showing
values of each variable as it changes.
 Run-time errors happen when Program executes an invalid instruction or out of
bounds error or attempts to divide by zero. Program may halt unexpectedly or go into
an infinite loop. If a program is being tested in IDE, then this type of error may be
managed, and a suitable error message given.
If program has already been released for use and run-time error occurs, developer
should be informed so that program can be updated or a patch can be sent out to all
customers to solve problem.
A Patch is a small program, released by developers, to run with an existing program to
correct an error or provide extra functionality.

Why errors occur and how to find them

Software may not perform as expected for a number of reasons, such as:
 Programmer has made a coding mistake
 Requirement specification was not drawn up correctly.
 Software designer has made a design error.
 User interface is poorly designed, and the user makes mistakes
 Computer hardware experiences failure.

How are errors found?


The end user might report an error. This is not good for reputation of
software developer. Testing software before it is released for general use is essential.
Research has shown that the earlier an error can be found, the cheaper it is to fix it. It
is very important that software is tested throughout its development.
Purpose of testing is to discover errors. Program testing can be used to show presence
of bugs, but never to show their absence.
Testing Methods
Programs need to be tested before they are released. Tests begin from moment they
are written; they should be documented to show that program is robust and ready for
general use.

. Stub Testing:
✓ Stub testing technique is employed during development of modular programs.
✓ Tests are conducted even before all modules have been fully implemented.

Computer Science IGCSE, O & A level By Engr M Kashif 03345606716


12.4 Program Testing & Maintenance

✓ A dummy module is created to simulate or replace actual module or subroutine.


paperscambridge.com
✓ This dummy module typically contains an output statement or returns a fixed value to
indicate that call to the module has been made.
Black-box Testing
✓ Black-box Testing focused on functionality of software without considering its
internal code structure.
✓ Test cases are designed based on software's specifications, requirements, and
expected behavior.
✓ Testers do not have access to internal workings of software being tested.
✓ Primary goal is to ensure that software functions correctly from user's perspective.
✓ Test inputs and expected outputs are determined without any knowledge of how the
software achieves its results.
✓ It helps identify errors, bugs, and discrepancies between expected and actual
behavior of software.
White -box Testing
As programmer, we can see our program code and our testing
will involve knowledge of code. We choose suitable test data that checks every path
through code. This is called white-box testing. Example:
INPUT Number1 , Number2 , Number3
IF Number1 > Number2
THEN // Number1 is bigger
IF Number1 > Number3
THEN
OUTPUT Number1
ELSE
OUTPUT Number3
ENDIF
ELSE // Number2 is bigger
IF Number2 > Number3
THEN
OUTPUT Number2
ELSE
OUTPUT Number3
ENDIF
ENDIF

Computer Science IGCSE, O & A level By Engr M Kashif 03345606716


12.4 Program Testing & Maintenance

paperscambridge.com

Dry-running Algorithm
Best way of checking that an algorithm works as intended is
to dry-run the algorithm using a trace table and different test data. This is also known
as a walk through.
Idea is to write down current contents of all variables and conditional values at each
step of algorithm.
Integration Testing Software consists of many modules written by different
programmers. Each individual module might have passed all tests, but when modules
are joined together into one program, it is vital that whole program is tested. This is
known as integration testing. Integration testing is usually done incrementally.
Alpha Testing
Software will be tested in-house by software testers before being
released to customers. This type of testing is called alpha testing.

Acceptance Testing Bespoke software written for a specific customer will be


released to customer. Customer will check that it meets their requirements and works
as expected. This stage is referred to as acceptance testing. It is generally part of hand-
over process. On successful acceptance testing, customer will sign off software.
Beta Testing
When software is not bespoke but produced for general sale, there is
no specific customer to perform acceptance testing and sign off software. So, after
alpha testing, a version is released to a limited audience of potential users, known as
‘beta testers’. These beta testers will use software and test it in their own
environments. This early release version is called beta version and chosen users
perform beta testing. During beta testing, users will feedback to software house any

Computer Science IGCSE, O & A level By Engr M Kashif 03345606716


12.4 Program Testing & Maintenance

problems they have found, so that software house can correct any reported faults.
Program Maintenance paperscambridge.com
During design stage of a software project, a suitable testing strategy must be worked
out to ensure testing of software from very beginning. We need a test plan. In first
instance, an outline plan is designed, for example:
 Flow of Control: Does user get appropriate choices and does chosen option go
to correct module?
 Validation of input: has all data been entered into system correctly?
 Do loops and decisions perform correctly?
 Is data saved into correct files?
 Does system produce correct results?
 Select test data that will allow us to see whether it is handled correctly.
Type of test data Explanation
Normal (valid) Typical data values that are valid
Abnormal (erroneous) Data values that system should not accept
Boundary (extreme) Data values that are at a boundary or an extreme end of range.
Program Maintenance categories:
 Corrective maintenance is used to correct any errors that appear during use, for
example trapping a run-time error that had been missed during testing.
 Perfective maintenance is used to improve performance of a program during its use,
for example improving the speed of response.
 Adaptive maintenance is used to alter a program so it can perform any new tasks
required by customer. E.g working with voice commands as well as keyboard entry.

**********************

Computer Science IGCSE, O & A level By Engr M Kashif 03345606716

You might also like