Part IV Testing Flashcards

1
Q

What is a test case specification?

A

A document describing the test case of a particular test

Contains:
a) Test case specification identifier
b) Test items
c) Input specifications
d) Output specifications
e) Environmental needs
f) Special procedural requirements
g) Intercase dependencies

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

What does a test procedure specification contain?

A

a) Test procedure specification identifier
b) Purpose
c) Special requirements
d) Procedure steps

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

What are XUnit family testing frameworks?

A

Frameworks that make specifying tests, executing tests, and reporting the results easier -> by automation

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

Why is it important to automate tests?

A

Manually running test scripts is tedious, error prone, and expensive

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

What is the difference between JUnit 3.8 and JUnit 4?

A

JUnit4 uses annotations (e.g. @Test) to identify test cases rather than reflection in JUnit 3.8

JUnit4 offers support for pre-test (set up) and post-test (tear down) management

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

How do you describe a test?

A

What is the IUT (Implementation under test)

What is the pretest state

What are the inputs (test case values and other inputs)

What is the expected state

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

What are some problems with test automation?

A

Certain artifact testing cannot be automated (testing user interfaces)

Hard to exercise potential failure situations (e.g. timing problems in real-time or concurrent software)

Some designs cannot be easily automatically tested

A lot of work needed to support traceability - relationship between tests executed and client’s requirements

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

What defines a good test?

A

The purpose of testing is to detect the presence of faults

Hence, the higher the probability of causing a failure (assuming a fault exists), the better the quality of the test

The quality of the overall test suite is more important than the quality of the individual tests

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

What is statement coverage?

A

The number of statements executed by all tests divided by total number of statements

The intuition is that each line may contain a fault and so the more lines that are executed the higher chance of causing a failure

It is a measure of test suite quality

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

Is 100% statement coverage always possible?

A

No, code may contain dead code (unreachable code)

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

What is white box testing?

A

Performing tests based on how the component is implemented (focus on the artifact e.g. code)

Decide on tests based on the code itself

Not good at detecting faults related to requirements

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

What is black box testing?

A

Performing tests based on what the component is supposed to do (focus on quality attribute)

Decide on tests based on requirements independent of the code

Not good at detecting faults in implementation decisions

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

What is a control flow graph?

A

DIrected graph used to model the control flow of a program

Vertex = statement
Edge = (A,B) if control flows from statement A to B

We are interested in the number of different ways control flow can occur through the code

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

What is a basic block?

A

A sequence of statements that have the following properties:

First statement is always the first statement executed (one entry point)
Only last statement can cause the program to begin executing code in a different basic block (one exit point)

ie. If first statement is executed then all statements in the basic block are executed

Can be used to simply control flow graphs

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

What is a test requirement?

A

A specific element of a software artifact that a test case must satisfy

e.g. statement A must be executed

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

What is a coverage criterion?

A

A rule or set of rules that impose test requirements on a test suite

e.g. the statement executed criterion imposes, for every statement x, the test requirement that statement x must be executed

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

What is coverage level?

A

The ratio of the number of test requirements satisfied by the test suite to the total number of test requirements

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

What is a test path?

A

Sequence of vertices in the CFG such that the first is the entry vertex, the last is the exit vertex and every pair of adjacent vertices is connected by an edge in the CFG

ie potential path through code

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

What is path coverage?

A

Coverage criterion - any test path
Intuition - any execution flow is represented by a path, so any missed paths may correspond to incorrect execution

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

What is condition coverage?

A

Given a compound expression (e.g. if ( a > 0 || b > 0) ) in order to detect all possible faults, all combination of sub-expressions must be tested

Can be modelled by breaking the compound expression into more if statements

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

What is the difference between a failure and an error according to JUnit?

A

Failure -> the expected result specified by human tester was not what JUnit observed (typically a failed assertion)

Error -> JUnit was unable to complete the test. Typically some exception that is thrown and not caught

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

What is a path vs test path?

A

A path is a CFG sequence of vertices

A test path is a path where the first vertex is the entry vertex and the last vertex is the exit vertex

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

What is a simple path?

A

Every vertex only appears once in the path

Or

The only vertex that appears twice is the first and last vertex in the path

24
Q

What is a prime path?

A

A maximal length simple path

Path p is prime if it is simple (ie each vertex only appears once in the path) and has the maximum length (not a subpath of any other path)

25
Q

What are the actions that can occur to data objects?

A

Defined (d) - data value comes into existence, assigned to variable
Killed or undefined (k) - data value no longer available
Usage (u) / Computation (c) - used for computation
Usage (u) / Predicate (p) - used in a predicate

26
Q

How do you know a data object has been defined?

A

A location where a value is stored into memory

  • variable appears on the left side of assignment operator
  • formal parameter of a method (occurs in entry vertex)
  • input to a program
  • actual parameter in a method invocation and the method changes its value
27
Q

How do you know a variable is being used?

A

A location where a variable’s value is accessed

  • appears on right hand side of an assignment
  • appears in a predicate (conditional test)
  • an actual parameter in a method invocation
  • return statement for a method
  • output of a program
28
Q

Data action order check: dd

A

(mostly) harmless, but worth checking

29
Q

Data action order check: dk

A

possible fault

30
Q

Data action order check: du

A

normal case

30
Q

Data action order check: kd

A

normal case

31
Q

Data action order check: kk

A

it’s dead already (suspicious)

32
Q

Data action order check: ku

A

fault (not possible in some languages)

33
Q

Data action order check: ud

A

probably not a fault

34
Q

Data action order check: uk

A

normal

35
Q

Data action order check: uu

A

normal

36
Q

Data action order check: -k

A

variable not defined but then killed

37
Q

Data action order check: -d

A

first definition in path -> normal

38
Q

Data action order check: -u

A

used before defined

Issues with global data

39
Q

Data action order check: k-

A

killed is the last thing that happens

40
Q

Data action order check: d-

A

defined but never used

Issues with global data

41
Q

Data action order check: u-

A

used but never killed, probably ok

42
Q

What is a DU-path?

A

Checking whether a value that is defined is correct for a given use

A du-path with respect to variable x is a simple path (series of vertices) that is def-clear with respect to x such that the first vertex of the path is where x is defined and the last vertex is where x is used

43
Q

What is all du-paths?

A

Visit every du path for every variable

  • strongest data flow strategy
  • not as strong as all paths
44
Q

Are du-paths practical?

A

All du-paths requires 2^t in the worst case, where t is the number of conditional transfers (conditions)

All du-paths may not produce a better test suite (or even more tests) than branch coverage, but it usually does better

45
Q

What is the procedure for creating a test suite based on du-paths?

A

Identify definitions of values

Identify uses of those definitions

Identify (control flow) paths from definitions of values to their uses (du-paths)

Choose a set of du-paths based on chosen testing strategy (e.g. all paths, all predicate-use)

Create a test suite that causes all of the chosen du-paths to be followed

46
Q

What is equivalence partitioning?

A

The idea that you should be testing inputs that add value to the test -> increase the chances of failure

Partition possible input values into equivalence classes such that every possible input value is in at most one equivalence class (classes are disjoint) and every possible input value is in at least one equivalence class (union of all classes is all possible input values)

The aim should be that there is at least one input value tested from each equivalence class

47
Q

What is boundary value analysis?

A

Choosing test cases from the boundaries of the equivalence classes as faults often occur at the edges

Should aim to have inputs from both sides of every boundary

48
Q

What is a predicate?

A

An expression that evaluates to a boolean value

Predicates can contain:
- boolean variables
- relationship expressions
- methods that return booleans
- expressions involving logical operators (!, &&, ||, etc)

49
Q

What is a clause?

A

A predicate with no logical operators - not, and, or, etc

50
Q

What is predicate coverage?

A

Given a predicate p, there are two test requirements - p evaluates to true, and p evaluates to false

Same as branch coverage

51
Q

What is clause coverage?

A

For every clause in a predicate p, there are two test requirements - c evaluates to true or false

52
Q

What is combinatorial coverage?

A

For a predicate p, there is a test requirement for every combination of truth values for every clause c in p

Similar to condition coverage

53
Q

What are the advantages and disadvantages of combinatorial coverage?

A

Predicate coverage does not exercise all clauses

Clause coverage does not always ensure predicate coverage

However combinatorial coverage grows exponentially -> subset of combinatorial coverage that tests each clause independently from the other clauses

Conclusion -> find a good subset of combinatorial coverage such that still gives a good quality test suite

54
Q

What is an active clause?

A

For a given predicate, choose one clause as the major one -> rest become minor clauses

An active clause is a major clause that will determine the value of the predicate

55
Q

What is active clause coverage?

A

For each predicate choose major clauses and ensure that all major clauses evaluate to true and false.

Active clause coverage maximises the variation of the value of the predicate white restricting the number of variation of clauses needed ie only change clauses that matter