Test 2 Flashcards

1
Q

What are the 6 requirements for the following functionality coverage test:
“Given as input two integers x and y, output all the numbers smaller than
or equal to x that are evenly divisible by y. If either x or y is zero, then
output zero.”

A

“Given as input two integers x and y”
R1. Accept two integers as input.
“output … the numbers”
R2. Output zero or more (integer) numbers.
“smaller than or equal to x”
R3. All numbers output must be less than or equal to the first input
number.
“evenly divisible by y”
R4. All numbers output must be evenly divisible by the second number.
“all the numbers”
R5. Output must contain all numbers that meet both R3 and R4.
“If either x or y is zero, then output zero.”
R6. Output must be zero (only) in the case where either first or second
input integer is zero.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Is Functionality Coverage testing systematic? Explain.

A

Yes, we have a system for creating tests, it tells us when we are done.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the guidelines for choosing test inputs in black box testing.

A

(1) Consistently choosing the simplest input values possible, in order not
to introduce arbitrary variations
(2) Keeping everything constant between test cases, varying only one
input value at a time (don’t try to be “clever” introducing random input
variations)

These hold for all systematic test methods.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Name the 3 types of Black Box Methods.

A
  1. input coverage tests, which are based on an analysis of the intended
    inputs, independent of their actions or outputs
  2. output coverage tests, which are based on an analysis of the intended
    outputs, independent of their inputs or actions
  3. functionality coverage tests, which are based on an analysis of the
    intended actions, with or without their inputs and outputs
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Name 4 Input Coverage Tests.

A

exhaustive, (input) partitioning, shotgun, (robustness) boundary

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is Exhaustive Testing?

A

▪ Involves testing the program with every possible input – yields a strong
result: virtually certain that the program is correct
▪ Easy system for test cases, and obvious when done
▪ But usually impractical, even for very small programs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is Input Partition Testing?

A

Partition all the possible inputs into equivalence classes
which characterize sets of inputs with something in common.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

List all relevant partitions for the following input partition test:

“Given as input two integers x and y, output all the numbers smaller than or
equal to x that are evenly divisible by y. If either x or y is zero, then output
zero.”

What numbers would we use?

A

Partition: x input, y input
P1: 0, non-zero
P2: non-zero, 0
P3: 0, 0
P4: less than zero, less than zero
P5: less than zero, greater than zero
P6: greater than zero, less than zero
P7: greater than zero, greater than zero

-1, 0, 1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Advantages of Input Partition Testing?

A

intuitively
easy to identify a set of partitions given the functional
specification
easy to say when we are done
confidence that the program is at least capable of handling (one
example of) each different kind of input correctly

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is Shotgun Testing

A

Black box shotgun testing consists of choosing random values for inputs
(with or without worrying about legality) over a large number of test runs
▪ We then verify that the outputs are correct for the legal inputs, and that
program simply did not crash for illegal ones
▪ More practically, we usually choose inputs from the legal set and inputs from
the illegal set as separate sets of shotgun tests

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Is Shot Gun Testing Systematic?

A

No, there is a system for choosing test cases (i.e. randomly), but there are no completion criteria (we don’t know when we are done).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is Boundary testing?

A

testing checks for crashes on unexpected or unusual input, such
as the boundaries of the input range.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is Exhaustive Output Testing

A

▪ Exhaustive output testing makes one test for every possible output
▪ Practical more often than exhaustive input testing, because programs are
often written to reduce or summarize input data (like the previous example)
▪ But still impractical in general - most programs have an infinite number of
different possible outputs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What testing is best used for this problem “Output 1 if two input integers are
equal, 0 otherwise”

A

Output testing because there is only two cases.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is Output Partition Testing?

A

Output partitioning is like input partitioning, only we analyze the possible
outputs
▪ In a fashion similar to input partitioning, we partition all the possible outputs
into a set of equivalence classes which have something in common

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Difference between Black Box Testing and White Box Testing?

A

Black: Uses specifications not code
White: Uses code

17
Q

What is the system for creating block-based coverage?

A

Identify basic blocks by sequence analysis then design a test case for each basic block.

We make a test case for each block to analyze which inputs are needed to cause the block to be entered.

18
Q

What is Decision Coverage

A

Causes every decision (if, switch, while, etc.) in the program
to be made both ways (or every possible way for switch)
* System: Design a test case to exercise each decision in the
program each way (true / false)
* Completion criterion: A test case for each side of each decision

19
Q

Whats is Loop Coverage?

A

This method makes tests to exercise each loop in the program
in four different states :
- execute body zero times (do not enter loop)
- execute body once (i.e., do not repeat)
- execute body twice (i.e., repeat once)
- execute body many times
System: Devise test cases to exercise each loop with zero, one,
two and many repetitions
* Completion criterion: A test for each of these cases for each loop

20
Q

What is Execution Paths?

A

An execution path is a sequence of executed statements
starting at the entry to the unit (usually the first statement)
and ending at the exit from the unit (usually the last statement)
* Two paths are independent if there is at least one statement on
one path which is not executed on the other
* Path analysis (also know as cyclomatic complexity* analysis)
identifies all the independent paths through a unit

21
Q

What is cyclomatic complexity?

A

E - N + 2
E: # of Edges
N: # of Nodes

22
Q

Advantages of Path Coverage Testing?

A
  • Covers all basic blocks (does all of basic block testing)
  • Covers all conditions (does all of decision/condition testing)
  • Does all of both, but with fewer tests!
  • Can be automated (actually, in practice requires automation)
23
Q

Disadvantages of Path Coverage Testing?

A

Does not take data complexity into account at all

24
Q

For Data Flow Coverage define: P-Use, C-Use, Definition

A

A P-use of a variable is a predicate use (e.g. if statement)
* A C-use of a variable is a computation use or any other use
(e.g. I/O statements)
A variable is defined if it is assigned a new value during a
statement execution

25
What is the mutation score?
of mutations killed / total # of mutations
26
What are the systematic Mutation approachs?
▪ value mutations (changing constants, subscripts or parameters by adding or subtracting one, etc.) ▪ decision mutations (inverting or otherwise modifying the sense of each decision condition in the program) ▪ statement mutations (deleting or exchanging individual statements in the program)