A Practical Learning Guide to Software Testing by Olusola Samuel Fatiregun

A Practical Learning Guide to Software Testing by Olusola Samuel Fatiregun

Author:Olusola Samuel Fatiregun [Fatiregun, Olusola Samuel]
Language: eng
Format: epub
Publisher: UNKNOWN
Published: 2017-02-07T08:00:00+00:00


White Box, Glass box or Structure-based Techniques

 It is structure-based because the internal structure of software (i.e. code) is used to design Test Cases

 The code must be visible to testers

 So understanding of internals (code) is required

 Specification is still used to determine expected results, as for black-box

Code  Pseudo code at foundation level

o Limited language

o Simple structure

o Helps to create all the main control structures

 Non executable

o At the start of the code

o No action

o Declarative and preparative

 Executable

o Instructs the computer to take action

o starts with BEGIN……ends with END when combined with Non Executable

Code Structure 1. Sequence

o Statement executed one after the other as they appear on page

2. Selection

o Computer decides if a condition is true or false (Boolean) then takes a route based on the outcome

o Involves decisions

3. Iterative

o Repeat exercising of a chunk of code

o Number of iteration depends on the value of a condition

Sequence Example:

1. Read X

2. Read Y

3. Z = X*Y

Note: We have 3 executable statements here; 1 is done before 2, then 3. No Non executable statement. Absence of BEGIN and END is common practice in ISEB so be aware! Selection

Example:

1. IF K < 5 /*condition*/

2. THEN

3. X = X+1 /*condition in 1 is TRUE*/

4. ELSE

5. X=X-1 /*condition in 1 is FALSE*/

6. ENDIF /*Terminates the IF THEN ELSE*/

Iteration  Also known as Loops

 Two types:

1. DO WHILE or WHILE DO 2. REPEAT UNTIL

 Involve at least a condition

 Also involve at least a decision

 DO WHILE : Condition at the beginning

 REPEAT UNTIL: Condition at the end

DO WHILE LOOP

Example:

Figure 25: DO WHILE LOOP Example Hands-on Practice Exercise 8

1. How many iteration(s) will be achieved in this loop (Figure 25)?

2. How can you alter the code to achieve no iteration?

REPEAT UNTIL LOOP Example:

Figure 26: REPEAT UNTIL LOOP Example Hands-on Practice Exercise 9

1. How many iterations will be achieved in this loop?

2. How can you alter the code to achieve no iteration?

Flow Chart Structures

Figure 27: Flow Chart Structures

Control Flow Graph  Method of representing decision points and the flow of control within a code  Only shows decisions

 Concentrate on parts of the code (statements) affecting the flow of control  Contains

o Nodes : decision points, END WHILE or ENDIF

o Edges: line connecting the nodes

Figure 28: Control Flow Graph

Control Flow Subgraphs

Figure 29: Control Flow Subgraphs

Statement Testing and Coverage  Testing aimed at exercising programming statements

 Every executable statement is tested by 100% statement coverage  Do not count non executable statements

 Converting code to flow charts is a good way of knowing where the executable

statements are

 Executable statements are represented by diamonds or rectangles on a flow chart  We can also use Conventional Control Flow Diagrams to determine Statement

Coverage – this called a Hybrid Flow Diagram

 Exclude non executable statements that precede BEGIN

 Ignore blank lines

 Weak /inadequate measure of test

Decision Testing and Coverage  Decisions in a program are tested

 A decision is tested when a condition associated with it is true and false  100% decision coverage is measured by counting



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.