Clear testing goals Flashcards

1
Q

Software Metrics

A

System or standard of measurement which gives a value to some property

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

Coverage

A

A measure of proportion of a structure that a program, test case, test suite exercises.

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

List test coverage methods based on rigour from low to high.

A
  1. Statement coverage
  2. Decision coverage
  3. Condition Coverage
  4. Condition/Decision Coverage.
  5. Modified Condition/decision coverage.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What can analysis of structural coverage discover?

A
  • Shortcomings in requirements-based test cases
  • inadequacies in requirements
  • dead code/deactivated code
  • unintended functionalities.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Path coverage

A

Test suite achieves path coverage if it results in every path in the program taken at least once.

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

Path coverage v. Exhaustive testing

A

Not the same. Path coverage ensures each control flow path is seen once. not that all paths have seen all possible values.

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

Statement Coverage

A

Test suite achieves Statement coverage if it results in each statement in the program being run at least once.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q
Statement coverage for:
int abs(int x) {
    int ans = x;
    if x < 0 {
       ans = -x
    }
    return ans;
}
A

test case: abs(-4).

Hits every statement in the code but doesn’t hit every branch in the program.

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

Branch Coverage

A

Test suite achieves branch coverage if it results in each branch in the program being run at least once.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
Branch coverage for:
int abs(int x) {
    int ans = x;
    if x < 0 {
       ans = -x
    }
    return ans;
}
A

test case: abs(-4)
test case: abs(4)

All branches taken in the program.

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

Path coverage v. Branch coverage?

A

Path coverage ensures each control flow path is taken.
Branch coverage ensures that each INDIVIDUAL branch is taken.
But there are combinations of branches that may not have been seen!

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

Condition Coverage

A

Test suite achieves path coverage if it results in each condition in each branching instruction being both true and false. (true, true) and (false, false) for if (a || b)

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

Combinatorial coverage

A

Test suite achieves combinatorial coverage if it results in each condition in each branching instruction being tried in all combinations of truth values.

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

What is required for combinatorial coverage:

if (avrageMark >= 50 or hardFailCount == 0 or elephantCount > 3) {

A

(50, 0, 4) = (true,true,true)
(50, 0, 3) = (true,true,false)
(50, 1, 4) = (true, false, true)

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

Modified Condition/Decision Coverage

A

100% branch coverage
100% condition coverage
each entry/exit point is exercised
each condition affects the behaviour independently.

if (a or b)
(TF), (FT), (FF)

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

Limitations of MC/DC

A
  • For large number of inputs, A LOT OF TEST CASES.
  • MC/DC is expensive and not a lot of evidence that it is valuable
  • Used as a check box. Have you done it or not?
17
Q

Source vs Object code coverage

A

Structural coverage at source level can differ from that at the object code level. Ie. multiple object code statements can be generated from a single source code statetement.

18
Q

Structural coverage vs structural testing
SC: Statement, Decision, MC/DC
ST: Statement, branch, Condition, Path

A

SC: determine which code structure was not exercised by the requirements based test procedures.
ST: process of exercising software with test scenarios written from the source code not from requirements.

19
Q

Structural testing limitations

A

provides no info about whether the code is doing what it’s supposed to be doing as specified in the requirements.

20
Q

What is Criteria Subsumption

A

A Subsumes B if every test suite that satisfies A also satisfies B.

Branch coverage subsumes statement coverage.

21
Q

If A subsumes B, will test suite satisfying A find all failures for B than a test suite satisfying B?

A

NO! in general this is true that test suites meeting subsuming criteria do find more failures but no guarantee.

22
Q

Does test suite for branch coverage find all failures that a test suite satisfying statement coverage does?

int abs(int x) {
  int ans = x;
  if (x < 2) {
    ans = -x
  }
  return ans;
}
A

test suite for branch coverage:
abs(10) = 10 pass
abs(-10) = 10 pass
achieves both statement and branch coverage.

test suite for statement coverage:
abs(-1) = -1 fail