Docsity

Notes on Test Case - Software Verification/Validation/Test | CSE 565, Study notes of Computer Science

Toggle sidebar
bg1
Class notes for CSE565 Sept. 8th
Prepared by Tao Hu, Young Jin Kwon
Test Case
A set of test inputs, execution conditions, and expected results developed to verify
compliance with a specific requirement or requirements. [1]
Simply, we can write like:
Test Case = [input, expected output]
The cost of developing test cases
There are two cost need to consider:
The cost of generating inputs
The cost of generating expected outputs
In general, it’s more difficult to generate expected outputs than to generate the inputs.
The generating expected output is more expensive.
Oracle Problem
An example of oracle problem:
Suppose we have a new calculator with Fast Fourier Transform and Kalman Filter, how
do we know its functions are correct?
There are two ways:
Use existing software/hardware
This way is to compare it with existing software and hardware; as we know there
are some other calculators that work, so we compare with them.
Redundancy – duplicate the effort and use to cross check
For example: if there is one requirement, we give it two designs and two
implements, so each of them can do cross check.
One requirement
Design 1 Design 2
Implementation 1 Implementation 2
Cross check
Cross
check
pf3
pf4
pf5

Partial preview of the text

Download Notes on Test Case - Software Verification/Validation/Test | CSE 565 and more Study notes Computer Science in PDF only on Docsity!

Class notes for CSE565 Sept. 8th Prepared by Tao Hu, Young Jin Kwon Test Case A set of test inputs, execution conditions, and expected results developed to verify compliance with a specific requirement or requirements. [1] Simply, we can write like: Test Case = [input, expected output] The cost of developing test cases There are two cost need to consider:  The cost of generating inputs  The cost of generating expected outputs In general, it’s more difficult to generate expected outputs than to generate the inputs. The generating expected output is more expensive. Oracle Problem An example of oracle problem: Suppose we have a new calculator with Fast Fourier Transform and Kalman Filter, how do we know its functions are correct? There are two ways:  Use existing software/hardware This way is to compare it with existing software and hardware; as we know there are some other calculators that work, so we compare with them.  Redundancy – duplicate the effort and use to cross check For example: if there is one requirement, we give it two designs and two implements, so each of them can do cross check. One requirement Design 1 Design 2 Implementation 1 Implementation 2 Cross check Cross check

This approach is based on the assumption that two independent projects don’t make the same mistakes. Cross validation is seldom being practiced for the obvious reason: that we often have trouble or no enough time to implement one version, it is impossible to make it two versions. Path coverage This measure reports whether each of the possible paths in each function have been followed. A path is a unique sequence of branches from the function entry to the exit. [2] An example: There are 4 paths in the diagram. The problem of path coverage Path coverage has two severe disadvantages. The first is that the number of paths is exponential to the number of branches. For example, a function containing 10 if- y n y y n n

Data: - variable (global, local, parameters)

  • Constants (final) Data flow Data flow means two things: data flow computing and data flow analysis. Data flow computing An example: CPC 6600 computer CPU design. The idea is whenever data is ready, do computing. Data flow analysis We have to consider two types of data: Data use and data modify. For instance: A: = B + ↓ ↓ data modify data use For each path and for each variable, find out DU pair. (Definiton/Use) Data Flow Anomaly There may be DD (Definition/Definition) pairs and UD (Use/Definition) pairs in the code. DD pairs exist when a variable is redefined in the code. UD pair exists whenever you try to use a variable before it is defined.  DU okay  UD pair no good  DD pair strange Data flow analysis is expensive, because for every variable and every path, you have to analysis it. And the number could be very large. So in practice, it’s probably not worth it. Data flow testing usually addresses two things:  Interface issue  Initialization issue Since UD pairs and DD pairs can be bug, to avoid them, we should always do initialization before using a variable. Dynamic typing: In Object-oriented programming, there will be more problems, because the program can pass an object, we don’t know what it is. That called dynamic typing. How can we know what kind of variables are there? It requires the runtime verification. As the

programming language became more dynamic, we have to worry more about dynamic aspects. Path coverage completing problem: Suppose that we have path like There are 16 paths. If we do partitioning once in the center, there will be 4 + 4 = 8 paths. By doing this, we have to consider one integration. If we partition it in 4 parts, there will be 3 integrations. More partitioning we do, more integration have to be considered. It is not always good to do as many partitioning as possible. The cost and partition relation is shown as the curve below. The cost initially goes down, then at some point, rises up. Why? Because we push path problem into integration problem. Partitioning Cost