Exploring Pseudo-Testedness
Empirically Evaluating Extreme Mutation
Testing at the Statement Level
Megan Maton*, Gregory M. Kapfhammer, Phil McMinn
* Lead author and paper presenter
Slide 2
Slide 2 text
Extreme Mutation Testing (XMT)
Production Code Test Suite
2
⟳
✅
This method is pseudo-tested.
Slide 3
Slide 3 text
Extreme Mutation Testing (XMT)
Production Code Test Suite
3
⟳
This method is “required” for the test suite to pass.
❌
Slide 4
Slide 4 text
Does pseudo-testedness
exist within these required
methods?
4
Slide 5
Slide 5 text
Identifying pseudo-tested statements
5
Required Method Test Suite
Slide 6
Slide 6 text
Identifying pseudo-tested statements
6
Test Suite
⟳
Required Method
Slide 7
Slide 7 text
Identifying pseudo-tested statements
7
Test Suite
⟳
Required Method
Slide 8
Slide 8 text
Identifying pseudo-tested statements
8
Test Suite
⟳
Required Method
Slide 9
Slide 9 text
Identifying pseudo-tested statements
9
Test Suite
⟳
Required Method
Slide 10
Slide 10 text
Identifying pseudo-tested statements
10
Test Suite
⟳
Required Method
Slide 11
Slide 11 text
Identifying pseudo-tested statements
11
Test Suite
✅
Required Method
Slide 12
Slide 12 text
Identifying pseudo-tested statements
12
Test Suite
⟳
Required Method
Slide 13
Slide 13 text
Identifying pseudo-tested statements
13
Test Suite
⟳
✅
Despite the method being “required”, it contains a pseudo-tested statement…
Required Method
Slide 14
Slide 14 text
Research Questions
14
Slide 15
Slide 15 text
RQ1: How frequent are pseudo-tested elements?
RQ2: Do pseudo-tested elements have low mutation scores?
RQ3: Does PITʼs default set of operators effectively highlight
deficient testing with respect to pseudo-tested statements?
RQ4: What are the causes of pseudo-tested statements?
15
Slide 16
Slide 16 text
PseudoSweep: A Pseudo-Tested Code Identifier
16
16:00 Tool Demo in Fremont
https://github.com/PseudoTested/PseudoSweep
Slide 17
Slide 17 text
RQ1: How frequent are pseudo-tested elements?
17
7 projects contained no
pseudo-tested methods
6.1% of all methods were
pseudo-tested
21% of covered (required +
pseudo-tested) methods were
actually pseudo-tested
Slide 18
Slide 18 text
RQ1: How frequent are pseudo-tested elements?
18
1.08% of statements
pseudo-tested
4% of covered statements were
pseudo-tested
Pseudo-tested statements in
required methods made up
48% of pseudo-tested
statements
Slide 19
Slide 19 text
19
Mutation Testing seeds synthetic faults into code
to evaluate a test suites fault detection ability.
a > b mutates to a < b
If your test suite can detect the synthetic faults, it
will likely detect real faults.
RQ2 and 3: Background
Slide 20
Slide 20 text
RQ2: Do pseudo-tested elements have low mutation scores?
20
Overall method mutation scores
◾ 0.82 (Required)
╳ 0.40 (Pseudo-tested)
Slide 21
Slide 21 text
RQ2: Do pseudo-tested elements have low mutation scores?
21
Overall statement mutation scores
◾ 0.80 (Required)
╳ 0.57 (PiR)
PiR - Pseudo-tested statements within required methods
Slide 22
Slide 22 text
22
RQ3: Does PITʼs default set of operators effectively highlight
deficient testing with respect to pseudo-tested statements?
https://pitest.org/
State-of-the-art Mutation
Testing Tool for Java projects
Slide 23
Slide 23 text
23
https://pitest.org/quickstart/mutators/
Default Operator Set
RQ3: Does PITʼs default set of operators effectively highlight
deficient testing with respect to pseudo-tested statements?
Slide 24
Slide 24 text
24
Elements Mutants per Element
Required Methods 6.97
Pseudo-tested Methods 3.67
Required Statements 2.31
PiR Statements 0.92
PiR - Pseudo-tested statements within required methods
Testing deficiencies in pseudo-tested statements may have a lower
chance of being identified using PITʼs default operator set alone.
RQ3: Does PITʼs default set of operators effectively highlight
deficient testing with respect to pseudo-tested statements?
PIT places more mutants
in required methods
than pseudo-tested
methods
PIT places less than
one mutant per PiR
statement
Slide 25
Slide 25 text
RQ4: What are the causes of pseudo-tested statements?
⊚ No targeting assertion (70)
◖ Partial assertion (7)
⍉ No targeting test (9)
⃕ Unintended exception handling (6)
25
Slide 26
Slide 26 text
RQ4: ⊚ No targeting assertion (70)
Solution: add an assertion to check expected content is
between the tags
26
Production Code Test Suite
✅
Slide 27
Slide 27 text
RQ4: ◖ Partial assertion (7)
27
Multiple statements appending
to the string
Test only checks the final string
contains “foo” and “bar”.
And due to both shortOpts and
longOpts containing “foo” and
“bar”...
Line 5 and 7 are pseudo-tested
due to partial assertion.
Slide 28
Slide 28 text
RQ4: ⍉ No targeting test (9)
28
There is a test
checking the
exception is thrown
But no test to execute
the IF Statement to
True
Making the IF
statement
pseudo-tested
Slide 29
Slide 29 text
RQ4: ⃕ Unintended exception handling (6)
29
Checks if input string is a valid
input
And throws an
exception if it is
not valid