Lecture 7B - Program based Testing Flashcards

(18 cards)

1
Q

What is Mutation testing?

A

Faults (or mutations) are automatically seeded into your code, then your tests are run. If your tests fail then the mutation is killed, if your tests pass then the mutation lived.
- The quality of your tests can be gauged from the percentage of mutations killed.

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

Why use mutation testing?

A

We are essentially asking the question: What’s wrong with line coverage?

- Traditional test coverage (i.e. line, statement, branch, etc.) measures only which code is executed by your tests. It does not check that your tests are actually able to detect faults in the executed code. It is therefore only able to identify code that is definitely not tested.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

In general what are some useful techniques for working out if there are gaps in our tests are?

A

THESE HAVE BEEN STUDIED
- graph coverage techniques -|- may show us that there are portions of code that have never been tested
- logic coverage techniques -|- may show us we haven’t tested different sub-parts of conditions
- program-based mutation testing can be used to “test the tests” -|- if we mutate a program, and it still passes all our tests, something is wrong

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

What is Program-Based Mutation Testing?

A

Program-Based Mutation testing (also called “mutation analysis”) is a technique for evaluating the quality of a suite of software tests

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

What is an example of Program-Based Mutation Testing?

A
  • Suppose we have some program under a test, and a suite of tests designed to identify defects in it.
    • Mutation testing works by modifying the program under test in small ways (e.g. flipping a less-than sign to a greater-than; changing a hard-coded number from 0 to 1).
    • Mutations are usually designed to mimic typically programming errors, such as typographical errors, wrong choice of operator, or off-by-one errors
    • If one of our tests behaves differently for the mutant (vs on the original program), we say that test kills the mutant
      If the test suite doesn’t detect and reject the mutated code, we consider the test suite is defective, and we need to consider more/different test cases.

REFER TO SLIDES FOR EXAMPLE

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

What is the Theory of mutation test?

A

Mutation testing is a form of syntax-based testing
- Mutations (changes) to the program under test can be defined by a grammar

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

What is a ground string?

A

A string in the grammar
- (The term “ground” basically means “not having any variables” – in this context, not having any non-terminals)

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

What is a mutation operator?

A

A rule that specifies syntactic variations of strings generated from a grammar

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

What is a mutant?

A

The result of one application of a mutation operator on the ground string
- A mutant is a string

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

What do we mean by killing mutants?

A

If we have some mutant generated from the original ground string, and we look at one or several of our tests, we can ask: do they “kill” the mutant?
- i.e. Does the test(s) give a different result for the mutant, compared to the original?
- If it does, it’s said to “kill” the mutant.

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

Syntax-based coverage criteria – mutant coverage

A

When creating mutants (i.e. invalid strings), two simple criteria:
- use every operator once or
- use every production once

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

What are test requirements?

A

TR is test requirements. TR are descriptions of test cases that will be refined into executable tests

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

What is Mutation Production Coverage (MPC)?

A

For each mutation operator, TR contains several requirements, to create one mutated string m that includes every production that can be mutated by that operator

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

What is Mutation Operator Coverage (MOC)?

A

For each mutation operator, TR contains exactly one requirement, to create a mutated string m that is derived using the mutation operator

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

What are some practical concerns with mutation - Coverage criteria – practical concerns?

A

The number of test requirements for mutation is somewhat difficult to quantify because it depends on the syntax of the artifact as well as the mutation operators
- In most situations, mutation yields more test requirements than any other coverage criterion

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

What are some frameworks we can use for mutation testing?

A

Mutation testing is difficult to apply by hand and automation is more complicated than for most other criteria.
- As a result, mutation is widely considered a high-end coverage criterion, more effective than most but also more expensive.
- One common use of mutation is as a sort of gold standard in experimental studies for comparative evaluation of other test criteria.

17
Q

What are the advantages and disadvantages of using the frameworks?

A

Advantages:
- Identifies weak/ineffective tests I Very effective at finding problems
- Helps quantify how useful your tests are

Disadvantages:
- Can be time-consuming (large number of mutants to generate, whole test suite needs to be run many times)
- Results require some familiarity with mutation testing to be properly understood

18
Q

Mutation Testing Example

A

REFER TO SLIDES