DOMAIN ERROR

6.1 DOMAIN ERROR

Two fundamental elements of a computer program are input domain and program paths . The input domain of a program is the set of all input data to the program. A program path is a sequence of instructions from the start of the program to some point of interest in the program. For example, the end of the program is a point of interest. Another point of interest is when the program waits to receive another input from its environment so that it can continue its execution. In other words, a program path, or simply path, corresponds to some flow of control in the program.

A path is said to be feasible if there exists an input data which causes the program to execute the path. Otherwise, the path is said to be infeasible. Howden [1] identified two broad classes of errors, namely, computation error and domain error , by combining the concepts of input data and program path. The two kinds of errors have been explained in the following.

Computation Error : A computation error occurs when a specific input data causes the program to execute the correct, i.e., desired path, but the output value is wrong. Note that the output value can be wrong even if the desired path has been executed. This can happen due to a wrong function being executed in an assignment statement. For example, consider a desired path containing the statement result = f(a, b), where a and b are input values.

A computation error may occur if the statement is replaced by a faulty one, such as result = f(b, a). Therefore, the result of executing the path

can be erroneous because of a fault in the assignment statement, and this can happen in spite of executing a correct path.

Software Testing and Quality Assurance: Theory and Practice , Edited by Kshirasagar Naik and Priyadarshi Tripathy Copyright © 2008 John Wiley & Sons, Inc.

136 CHAPTER 6 DOMAIN TESTING

Domain Error : A domain error occurs when a specific input data causes the program to execute a wrong, that is, undesired, path in the program. An incorrect path can be selected by a program if there is a fault in one or more of the conditional statements in the program. Let us consider a conditional statement of the form if (p) then f1() else f2(). If there is a fault in the formulation of the predicate p, then the wrong function call is invoked, thereby causing an incorrect path to be executed.

The above two kinds of program errors lead us to view a computer program as performing an abstract mapping function as follows. Ideally, for each input value, the program assigns a program path to execute; the same program path can

be exclusively assigned (i.e., executed) for a subset of the input values. Here, the subset of the input values causing the same path to be executed is referred to an input domain or subdomain. Thus, the program is said to map a domain to a path within itself. Since there are a large number of values in the input domain of the program and there are a large number of paths in a program, we can view a program as partitioning the input space into a finite number of subdomains and assigning a distinct program path to each of the input subdomains.

We further explain the concept of program domains using Figure 6.1. The set D is the entire input set of a program P (Figure 6.1a). We call D the domain of the entire program. Set D can be an infinite set, and P may not have different computation behavior for each element of D . Instead, P may perform the same computation for all the elements in a certain subset of D . For example, as shown

in Figure 6.1b, P performs five different computations, one for each subset D 1 , ... ,D 5 . It may be noted that the partition of D is not visible outside P . Instead, P has a conceptual, in-built mechanism, as illustrated in Figure 6.1c, to decide the computation method needed to choose a specific branch when P is invoked with

a certain input. Such an input classifier may not exist in a program in a single, clearly identifiable form. The concept can exist as an entity as a cross-cutting concept; it is cross-cutting because portions of the input classifier can be found in different program modules. We show five different computations, computation for

D 1 through computation for D 5 , for subsets D 1 ,...,D 5 , respectively (Figure 6.1c). The part of P that decides what computation to invoke for a given element of D is called an input classifier . We remind the reader that the structure of a program may not resemble the case we have shown inside the larger circle in Figure 6.1c. The figure simply denotes the fact that a program does different computations for different subsets of its input domain. Programs perform input classification through sequences of predicates, though an input classifier may not exist as a single module.

Therefore, a program will perform the wrong computation if there are faults in the input classification portion. With the above backdrop, we define the following two terms:

A domain is a set of input values for which the program performs the same computation for every member of the set. We are interested in maximal domains such that the program performs different computations on adjacent domains.

6.2 TESTING FOR DOMAIN ERRORS

Program output Input domain D

Program P

(a)

Input domain D D 3 D 1

Program output D

Program P

(b)

Program P

Input domain D

Computation

for D 1

D 3 D 1 Conceptual

Program output D

input classifier

Computation for D 5

(c)

Figure 6.1 Illustration of the concept of program domains.

A program is said to have a domain error if the program incorrectly performs input classification. Assuming that adjacent domains perform dif- ferent computations, a domain error will cause the program to produce incorrect output.

Dokumen yang terkait

ANALISIS DANA PIHAK KETIGA PADA PERBANKAN SYARIAH DI INDONESIA PERIODE TRIWULAN I 2002 – TRIWULAN IV 2007

40 502 17

ANALISIS KEMAMPUAN SISWA SMP DALAM MENYELESAIKAN SOAL PISA KONTEN SHAPE AND SPACE BERDASARKAN MODEL RASCH

69 778 11

Analisis Komparasi Internet Financial Local Government Reporting Pada Website Resmi Kabupaten dan Kota di Jawa Timur The Comparison Analysis of Internet Financial Local Government Reporting on Official Website of Regency and City in East Java

19 819 7

STUDI PENJADWALAN DAN RENCANA ANGGARAN BIAYA (RAB) PADA PROYEK PEMBANGUNAN PUSAT PERDAGANGAN CIREBON RAYA (PPCR) CIREBON – JAWA BARAT

34 235 1

PENGARUH PENGGUNAAN BLACKBERRY MESSENGER TERHADAP PERUBAHAN PERILAKU MAHASISWA DALAM INTERAKSI SOSIAL (Studi Pada Mahasiswa Jurusan Ilmu Komunikasi Angkatan 2008 Universitas Muhammadiyah Malang)

127 505 26

AN ANALYSIS OF DESCRIPTIVE TEXT WRITING COMPOSED BY THE HIGH AND THE LOW ACHIEVERS OF THE EIGHTH GRADE STUDENTS OF SMPN SUKORAMBI JEMBER

11 83 16

AN ANALYSIS OF LANGUAGE CONTENT IN THE SYLLABUS FOR ESP COURSE USING ESP APPROACH THE SECRETARY AND MANAGEMENT PROGRAM BUSINESS TRAINING CENTER (BTC) JEMBER IN ACADEMIC YEAR OF 2000 2001

3 95 76

A DISCOURSE ANALYSIS ON “SPA: REGAIN BALANCE OF YOUR INNER AND OUTER BEAUTY” IN THE JAKARTA POST ON 4 MARCH 2011

9 161 13

Improving the Eighth Year Students' Tense Achievement and Active Participation by Giving Positive Reinforcement at SMPN 1 Silo in the 2013/2014 Academic Year

7 202 3

THE INTEGRATION BETWEEN INDONESIA AND WORLD RICE MARKET

1 88 12