170 likes | 364 Views
Testing. Testing Types of Errors Test Data Dry running Program Trace table . What is Testing?. Testing is the process of finding errors within the software . Testing can be carried out at all stages of the system development lifecycle
E N D
Testing Testing Types of Errors Test Data Dry running Program Trace table
What is Testing? • Testing is the process of finding errors within the software. • Testing can be carried out at all stages of the system development lifecycle • At each stage a certain test will be carried out • This makes sure the software is working as you would like it to
Test Plan • Before you start testing something you will have what is called a test plan • The plan will describes each item that needs to be tested • The test plan provides • instructions to be carried out • test data (inputs) • the expected outcomes • The set of test data and expected outcomes form a test case.
Types of Testing • There are a various number of techniques that can be applied that help select a test case that will find the largest number of errors • The two techniques we will be looking at are • Black Box techniques • White Box techniques.
Black Box Technique • Black box techniques see the software as a ‘black box’ which has inputs and outputs • No understanding of what is happening within the black box is needed • When testing, suitable inputs are selected based upon the running of the system
White Box Techniques • White box techniques analyse the structure and logic of the program. • This is then used both to help monitor the detail of testing and to guide the selecting of appropriate test data
Errors • Errors are a fault or a mistake in a program that causes the program to produce wrong results or not to work at all • Most computers attempt to indicate the source of an error by producing error messages • There are many different types of errors that could be found
Syntax Errors • Syntax errors are caused by forgetting certain codes and statement structures of the programming language being used • The program will not understand some statements because they do not obey the programming language’s rules • The compiler will find these errors • There can be various types of syntax errors, and the following are some syntax errors examples using JAVA.
Logical Errors • A logical error is a mistake found in the actual design of a program • An example is a branch to a wrong statement or the use of the wrong mathematical operation • Logical errors can be found by gaining the wrong results • The compiler does not notice these errors
Run Time Errors • Run time errors are errors which are shown when the program is actually running • Examples; • Division by Zero is caused when the program tries to divide something by 0 • Lack of Memory, this occurs when the program requires more memory than there is available hence it will not be able to function properly. • External Errors, such as an error in printing, because no printer could be found or it is turned off. • Unusual Data, which can occur when the user enters incorrect data. For example, if the user is asked to input a few numbers to add them up, and letters are entered, a runtime error will occur, because letters cannot be added. • Run Time errors can be prevented by writing statements to control them. For example, if the user needs to enter numbers, and the user enters letters, the program should be able to identify this and let the user know
Test Data • When we test our programs we should first create a test plan where the possible values to be tested are listed down • Then we would go through the test plan to be able to test different areas of the program. • For example, if the program asks the user to enter his/her name there would be various test data which we can be use; • Entering the actual name, • Leaving it blank, • Entering numbers instead of letters, • Entering a single letter. • All the possible answers will be tested by providing the inputs above Test Data
Dry Running • Dry running a program is basically working through a section of a program manually. • Dry running a program is useful for finding run-time errors • A dry one is done in parts by taking one section of the program at a time and not the whole program all at once • A program trace table is produced before the dry run starts, this table contains; • A column showing the instruction executed • columns for the contents of each variable
Trace table • The programmer uses the instructions from the trace table, adding a new line to the trace table each time an instruction is run. • The new line of the trace table shows the instruction (by its line number, and show any changes to the variables)