Course outline

Software QA / Advanced: strategy, resilience, and leadership / Lesson 21

Evaluate assertion strength with controlled mutations

Use small deliberate changes in a disposable test environment to investigate whether assertions detect plausible defects.

About 23 min read20 worked examples20 practice exercisesContent reviewed
On this page

Lesson goals

  • Design a mutation tied to an agreed rule.
  • Distinguish detected, surviving and inconclusive changes.
  • Use findings to improve assertions without overstating a score.
  • Design a controlled change and distinguishing input with an independent oracle and clean baseline.
  • Classify detection, survival, equivalence, and inconclusive results with explicit scope.

Ask whether an assertion can detect a defect

Mutation testing investigates whether a test suite detects small deliberate changes to behavior. The goal is to learn about the tests and their oracles, not to modify the released product or manufacture a perfect score. Use a disposable local copy and a synthetic eligibility rule: scores of 50 or above qualify. Establish that the original tests pass first, and save the original revision. A useful experiment asks what failure a particular assertion should detect and whether the result supports that claim.

Select a meaningful change

Choose a change tied to the rule, such as replacing greater-than-or-equal-to with greater-than. The boundary case 50 should then fail because the agreed result is eligible. A second change that accepts 49 should be detected by the negative boundary case. The table specifies the independently calculated expectations before the experiment. Do not infer success solely from the mutated process failing to build: a syntax error or missing dependency says nothing about the quality of the business assertion.

text Boundary evidence
Rule | Expected
score 49 | ineligible
score 50 | eligible
score 51 | eligible

The independently expected boundary distinguishes the listed changes.

Interpret survivors carefully

If a changed program survives, inspect the tests that ran, their selection, and the relevant inputs before adding an assertion. The changed expression may be unreachable in the selected setup, or the asserted output may be too weak. Some changes are equivalent for the supported domain, so no valid input distinguishes them; document the reasoning rather than inventing a case. A surviving change is an investigation prompt, not automatic proof of a production defect.

text Boundary evidence
Change | Discriminating case
score > 50 | 50 must be eligible
score >= 49 | 49 must be ineligible

The independently expected boundary distinguishes the listed changes.

Control the experiment

Run the experiment in a disposable checkout without production credentials or live services. Change one expression at a time and record the original result, the change, selected tests and observed failure. Restore the original revision after each experiment and verify the normal suite again. Do not weaken a test to make the changed program pass, and do not publish the deliberately altered code as a repair. The displayed table is illustrative; it claims no actual execution result.

Use findings to improve the suite

When the experiment exposes a real gap, derive a new expected result from the agreed requirement and explain why the existing checks missed it. Retain the smallest regression case that adds distinct evidence, then repeat the original test against the unmodified code. Track equivalent or inconclusive changes separately from detected behavioral changes. A mutation score depends on the selected changes and tests, so it cannot be interpreted as a universal probability of correctness or compared fairly without the same scope.

Use a controlled change to question an oracle

Mutation testing asks whether selected checks detect a small deliberate change that represents a plausible mistake. It assesses those checks under that experiment; it does not manufacture evidence that the released product is wrong. Start from an agreed rule and a clean baseline where the intended tests run and pass. Record the original revision, selected test cases, synthetic data, and independent expected results before changing one expression in a disposable local environment.

For an eligibility rule accepting scores of 50 or more, replacing >= with > changes the answer at 50. A test at 51 alone cannot distinguish those expressions. The interesting question is whether a selected assertion actually observes eligibility at the distinguishing input. All traces below are hypothetical fixtures for reasoning; they are not claims that a mutation tool or application was executed.

Classify what happened before counting

A behavioral change is detected when a selected test reaches the changed behavior and fails for the expected discrepancy. A surviving change means the selected run did not detect it; investigate whether the input reached the expression, whether the assertion observed the result, and whether the change affects any valid input. A syntax error, missing dependency, or timeout may prevent the intended comparison and should be recorded as invalid or inconclusive rather than counted as detection of a business defect.

Compare with the baseline result and inspect the failure message. A test that fails for an unrelated fixture error does not establish that its oracle caught the changed rule. Preserve test selection, input, output, and failure reason so another reviewer can repeat the classification. Terminology and score formulas vary by tool; state the categories and denominator used rather than assuming every tool counts outcomes identically.

Investigate survivors and equivalence

A survivor can indicate a missing boundary input, an unreachable changed branch, or an assertion that observes too little. For example, a check that only confirms a response exists may pass when the eligibility value changes. Add a case only after deriving its expected value from the approved rule. Do not change an expected result to match the mutated behavior or invent an invalid input merely to improve a score.

Some changes are equivalent on the supported domain. If valid inputs are only 0 and 1, two expressions that agree on both cannot be distinguished by another valid input in that domain. Document the domain and comparison, and revisit the conclusion if the contract expands. Equivalence may be difficult to establish; an unresolved survivor should remain unresolved rather than being declared equivalent by convenience.

Improve the assertion and its input together

A strong assertion needs a distinguishing input and an observation tied to the user rule. If the rule accepts 50 and a change from >=50 to >50 is selected, test score 50 and independently expect eligible. A score of 51 passes both versions and cannot distinguish them, regardless of assertion wording. For a one-grant rule, changing a duplicate guard may require a repeated request and a final grant count; checking only an error message can miss a duplicate write.

Use negative and positive cases where they add distinct evidence. After adding or repairing a test, run it against the unmodified baseline to ensure it passes for the right reason, then repeat the controlled change if the experiment permits. Keep exact expected values and domain assumptions separate from the implementation helper so the new test does not reproduce the same defect.

Keep deliberate changes disposable

Perform mutation experiments only in an isolated disposable checkout with synthetic inputs and no live services or production credentials. Make one deliberate change at a time, run the selected tests, save a sanitized result, restore the original revision, and verify the normal baseline again. A deliberately altered program is an experimental artifact and must not be published as a fix. If restoration or the baseline fails, stop and resolve the environment before interpreting further outcomes.

Control dependencies and test selection so an unrelated network or setup failure cannot be confused with detection. Record the change, baseline, selected tests, observed output, and final classification. A local fake can make a dependency response repeatable, but it also narrows what the experiment says about real integration. Clean up only the disposable resources owned by the experiment.

Use a score as a scoped diagnostic

A mutation score is meaningful only with its selected changes, tests, outcome categories, and denominator. For example, if six valid non-equivalent changes are assessed and four are detected, a simple detected fraction is 4/6, about 66.7%. Invalid builds and documented equivalent changes must not be silently mixed into that denominator; state the chosen convention and unresolved cases. The fraction is not a probability that the product is correct.

A high score can coexist with missing requirements, untested environments, or mutations unlike the faults that matter. A low score can reveal an oracle gap, an unreachable area, or an equivalent change requiring review. Use survivors to choose targeted improvements and preserve the reasoning, not to reward a number. Report the build, domain, selected mutation set, tests, classifications, and residual risk with the result.

20 worked examples

1. Boundary comparison

Problem: Analyze the synthetic boundary comparison scenario and determine the experiment classification or conclusion limit.

  1. The approved rule includes equality at 50.
  2. The changed expression excludes that same valid score. This follows from the stated synthetic domain and selected test.
text Synthetic scenario, not an execution record
rule: score >=50 is eligible
change: >=50 becomes >50
selected input: 50

The hypothetical fixture supplies rule, change, and test for analysis.

Expected result: The input distinguishes the changed comparison.

Why this result follows: An assertion expecting eligible at the boundary can detect this specific behavioral change.

2. Interior input

Problem: Analyze the synthetic interior input scenario and determine the experiment classification or conclusion limit.

  1. Both 51 >=50 and 51 >50 are true.
  2. The changed boundary behavior is not exercised by this input.
text Synthetic scenario, not an execution record
rule: score >=50 is eligible
change: >=50 becomes >50
selected input: 51

The hypothetical fixture supplies rule, change, and test for analysis.

Expected result: This input does not distinguish the two expressions.

Why this result follows: A strong assertion still needs an input on which the versions differ.

3. Negative boundary

Problem: Analyze the synthetic negative boundary scenario and determine the experiment classification or conclusion limit.

  1. The approved rule makes 49 ineligible.
  2. The changed expression accepts 49. This follows from the stated synthetic domain and selected test.
text Synthetic scenario, not an execution record
rule: score >=50 is eligible
change: >=50 becomes >=49
selected input: 49

The hypothetical fixture supplies rule, change, and test for analysis.

Expected result: The input distinguishes the broadened eligibility rule.

Why this result follows: A negative boundary assertion targets an incorrect expansion of the accepted domain.

4. Unrelated build failure

Problem: Analyze the synthetic unrelated build failure scenario and determine the experiment classification or conclusion limit.

  1. The changed program did not build.
  2. The selected assertion never compared the eligibility result. This follows from the stated synthetic domain and selected test.
text Synthetic scenario, not an execution record
baseline tests pass
changed program: syntax error before tests run
selected boundary case=not executed

The hypothetical fixture supplies rule, change, and test for analysis.

Expected result: Classify the experiment as invalid for business detection.

Why this result follows: A syntax failure supplies no evidence that the business oracle detected the intended change.

5. Unrelated fixture failure

Problem: Analyze the synthetic unrelated fixture failure scenario and determine the experiment classification or conclusion limit.

  1. The test failed before observing eligibility.
  2. The failure reason is the fixture setup rather than the changed comparison.
text Synthetic scenario, not an execution record
baseline passes
mutation runs; test fails during unrelated database setup
eligibility assertion=not reached

The hypothetical fixture supplies rule, change, and test for analysis.

Expected result: The result is inconclusive for the intended assertion.

Why this result follows: A failing test must fail for the relevant discrepancy to support an oracle-strength claim.

6. Boundary test run

Problem: Analyze the synthetic boundary test run scenario and determine the experiment classification or conclusion limit.

  1. The same valid boundary input reaches both versions.
  2. Its independently expected eligible result differs from the changed output.
text Synthetic scenario, not an execution record
baseline: score 50 -> eligible, test passes
changed >50: score 50 -> ineligible, assertion fails

The hypothetical fixture supplies rule, change, and test for analysis.

Expected result: The selected test detects this behavioral change.

Why this result follows: The failure is tied to the rule discrepancy rather than an unrelated build or setup problem.

7. Selected scores

Problem: Analyze the synthetic selected scores scenario and determine the experiment classification or conclusion limit.

  1. Both expressions reject 49 and accept 51.
  2. The selected inputs do not cover their distinguishing boundary.
text Synthetic scenario, not an execution record
selected tests: scores 49 and 51
change: >=50 becomes >50
all selected assertions pass

The hypothetical fixture supplies rule, change, and test for analysis.

Expected result: Investigate the missing score-50 case.

Why this result follows: A survivor can reveal a test selection gap rather than a production defect.

8. Weak response assertion

Problem: Analyze the synthetic weak response assertion scenario and determine the experiment classification or conclusion limit.

  1. The mutated response still exists.
  2. The assertion does not compare its eligibility value with the rule.
text Synthetic scenario, not an execution record
score=50; mutated output=ineligible
test asserts only response is nonempty

The hypothetical fixture supplies rule, change, and test for analysis.

Expected result: The change survives this weak assertion.

Why this result follows: Observing existence alone cannot detect a wrong business value. The conclusion is limited to the stated experiment and domain.

9. Refund branch selection

Problem: Analyze the synthetic refund branch selection scenario and determine the experiment classification or conclusion limit.

  1. The selected path never reaches the changed refund expression.
  2. A passing read case cannot observe its behavior.
text Synthetic scenario, not an execution record
mutation located in refund branch
selected test exercises enrollment read only
test passes

The hypothetical fixture supplies rule, change, and test for analysis.

Expected result: The survivor is uninformative about the refund oracle.

Why this result follows: Test selection and reachability must be checked before judging assertion strength. The conclusion is limited to the stated experiment and domain.

10. Two-value domain

Problem: Analyze the synthetic two-value domain scenario and determine the experiment classification or conclusion limit.

  1. For x=0 both expressions are false.
  2. For x=1 both are true, covering the complete supported set.
text Synthetic scenario, not an execution record
valid input x is 0 or 1
original: x >= 1
change: x == 1

The hypothetical fixture supplies rule, change, and test for analysis.

Expected result: The expressions are equivalent on the stated domain.

Why this result follows: No valid input in this domain distinguishes the two expressions. The conclusion is limited to the stated experiment and domain.

11. Domain expanded

Problem: Analyze the synthetic domain expanded scenario and determine the experiment classification or conclusion limit.

  1. At x=2 the original comparison is true.
  2. The equality comparison is false. This follows from the stated synthetic domain and selected test.
text Synthetic scenario, not an execution record
original: x >=1; change: x==1
old valid domain={0,1}; new domain={0,1,2}

The hypothetical fixture supplies rule, change, and test for analysis.

Expected result: Revisit equivalence because x=2 distinguishes the expressions.

Why this result follows: Equivalence is relative to the supported domain and can change with the contract.

12. Unresolved equivalence

Problem: Analyze the synthetic unresolved equivalence scenario and determine the experiment classification or conclusion limit.

  1. The input domain and expected rounding are not specified.
  2. Without them a valid distinguishing case cannot be established.
text Synthetic scenario, not an execution record
change affects decimal rounding
supported precision and rounding policy=unknown

The hypothetical fixture supplies rule, change, and test for analysis.

Expected result: Keep equivalence unresolved and ask the rule owner.

Why this result follows: Uncertainty about the contract should not be hidden by inventing an expectation.

13. Duplicate guard mutation

Problem: Analyze the synthetic duplicate guard mutation scenario and determine the experiment classification or conclusion limit.

  1. The first claim does not exercise a duplicate request.
  2. The changed guard matters when the same learner claims again.
text Synthetic scenario, not an execution record
rule: one grant per learner per year
change: duplicate guard removed
test: first claim only

The hypothetical fixture supplies rule, change, and test for analysis.

Expected result: The selected case may miss the changed repeat behavior.

Why this result follows: A repeated synthetic action and final count are needed to challenge the relevant risk.

14. Message-only mutation check

Problem: Analyze the synthetic message-only mutation check scenario and determine the experiment classification or conclusion limit.

  1. The error text can still match the expected message.
  2. The ledger contains two grants despite the one-grant rule.
text Synthetic scenario, not an execution record
changed duplicate guard allows second grant
test asserts duplicate error text only
ledger count=2

The hypothetical fixture supplies rule, change, and test for analysis.

Expected result: The message assertion misses the duplicate effect.

Why this result follows: A durable side-effect assertion detects harm that a message-only oracle overlooks. The conclusion is limited to the stated experiment and domain.

15. Baseline fails

Problem: Analyze the synthetic baseline fails scenario and determine the experiment classification or conclusion limit.

  1. The test already fails on the unmodified baseline.
  2. The second failure does not isolate an effect of the mutation.
text Synthetic scenario, not an execution record
original revision: selected test fails before mutation
changed revision: same test fails

The hypothetical fixture supplies rule, change, and test for analysis.

Expected result: Do not attribute the failure to the deliberate change.

Why this result follows: A clean baseline is necessary to interpret a difference caused by the experiment.

16. Checkout restoration

Problem: Analyze the synthetic checkout restoration scenario and determine the experiment classification or conclusion limit.

  1. The altered state may still be present.
  2. The normal baseline has not been verified after the attempted restoration.
text Synthetic scenario, not an execution record
mutation experiment finished
original revision restoration=failed
normal suite=not rerun

The hypothetical fixture supplies rule, change, and test for analysis.

Expected result: Stop and restore the disposable environment before further interpretation.

Why this result follows: Lifecycle control prevents an experimental change from contaminating later results. The conclusion is limited to the stated experiment and domain.

17. Scoped score

Problem: Analyze the synthetic scoped score scenario and determine the experiment classification or conclusion limit.

  1. The chosen numerator is four detected changes.
  2. Dividing by six assessed valid non-equivalent changes gives about 0.667.
text Synthetic scenario, not an execution record
valid non-equivalent changes=6
detected=4; surviving=2
invalid and equivalent excluded by stated convention

The hypothetical fixture supplies rule, change, and test for analysis.

Expected result: Detected fraction=4/6, approximately 66.7%.

Why this result follows: The score describes this selected set and convention, not probability of correctness.

18. Equivalent counted incorrectly

Problem: Analyze the synthetic equivalent counted incorrectly scenario and determine the experiment classification or conclusion limit.

  1. Two changes cannot alter behavior within the documented domain.
  2. Including them without disclosure changes the interpretation of the fraction.
text Synthetic scenario, not an execution record
selected changes=10
2 known equivalent; 4 detected
proposed score=4/10 without classification

The hypothetical fixture supplies rule, change, and test for analysis.

Expected result: Report categories and the chosen denominator explicitly.

Why this result follows: A score is reviewable only when equivalent and invalid outcomes are classified transparently.

19. Provider substitute

Problem: Analyze the synthetic provider substitute scenario and determine the experiment classification or conclusion limit.

  1. The selected run observes behavior against the fake.
  2. No real-provider response or persistence is part of the fixture.
text Synthetic scenario, not an execution record
mutation check uses local provider fake
real provider integration=not run

The hypothetical fixture supplies rule, change, and test for analysis.

Expected result: The result is limited to the simulated dependency.

Why this result follows: A local mutation result cannot establish real integration compatibility. The conclusion is limited to the stated experiment and domain.

20. Planned experiment

Problem: Analyze the synthetic planned experiment scenario and determine the experiment classification or conclusion limit.

  1. The fixture specifies an intended change and test.
  2. It contains no observed baseline or changed-run outcome.
text Synthetic scenario, not an execution record
baseline and candidate mutation described
execution results=none

The hypothetical fixture supplies rule, change, and test for analysis.

Expected result: Classify the experiment as planned, not detected or surviving.

Why this result follows: A mutation design is not evidence that an assertion executed or detected a change.

Common errors and fixes

Counting a build failure as a detected business defect

Why it happens
The experiment never reached the intended assertion.
How to fix it
Record it as invalid and repair the experiment.
Prevent it next time
Check that the changed program executes the selected case.

Adding an invented expectation for an equivalent change

Why it happens
Not every syntactic change alters behavior in the supported domain.
How to fix it
Document equivalence or the unresolved domain.
Prevent it next time
Review the contract and valid inputs before judging a survivor.

Publishing the deliberately altered program

Why it happens
The experiment was performed in an uncontrolled working copy.
How to fix it
Restore the original revision and rerun the normal suite.
Prevent it next time
Use a disposable local checkout and record its lifecycle.

20 practice exercises

1. The original rule accepts 50, but a mutation uses score > 50. Which case distinguishes it?

Show hint

Choose equality and derive baseline eligibility from the rule.

Show worked solution

Use score 50 and independently expect eligible. The mutated condition rejects it, so a correct assertion should fail if that case executes.

The approved rule accepts score 50 while score > 50 rejects it. Use 50 and independently expect eligible; the eligibility assertion should fail when the changed comparison executes, while passing on the unmodified baseline.

Check your solution

  • Score 50 is eligible under the rule.
  • The changed condition rejects it.

2. A changed comparison survives, but only inputs of 0 or 1 are valid and both expressions agree on those inputs. How should it be reported?

Show hint

Compare both expressions for every supported input.

Show worked solution

If the domain and equivalence are established, record the change as equivalent for that domain rather than inventing an invalid input. Revisit the judgment if the supported domain changes.

If valid values are only 0 and 1 and the expressions agree on both, document equivalence for that domain rather than inventing an invalid input. Revisit the judgment if the contract expands and a distinguishing input becomes valid.

Check your solution

  • The {0,1} domain and comparison are documented.
  • Equivalence is revisited when the domain changes.

3. An approved rule accepts scores at least 60. A deliberate change uses greater than 60. Choose a distinguishing input.

Show hint

The equality point separates the comparisons.

Show worked solution

Use score 60 and independently expect eligible under the inclusive rule. The changed expression rejects 60, so an assertion on the eligibility value should fail if it reaches that expression. Record the clean baseline and selected test; score 61 would not distinguish the two comparisons.

Check your solution

  • Score 60 is eligible by the rule
  • The changed comparison rejects 60

4. An eligibility rule accepts 50 or more; a change accepts 49 or more. Design a negative boundary case.

Show hint

Pick the newly accepted value.

Show worked solution

Use score 49 and expect ineligible under the approved rule. The deliberate change accepts it, so a test that observes the eligibility value can detect the broadened boundary. Also verify the unmodified baseline passes before interpreting the changed run, and keep score 50 as a separate positive case.

Check your solution

  • 49 is expected ineligible
  • The change accepts 49

5. A test uses score 51 against a change from >=50 to >50 and passes. What does that show?

Show hint

Compare both expressions at the selected input.

Show worked solution

Both expressions accept 51, so the pass does not show whether the test would detect the boundary change at 50. Add an independently justified score-50 case and inspect the eligibility value. Record the survivor as a selection gap rather than claiming that the mutation proves a product defect.

Check your solution

  • Both versions accept 51
  • Score 50 is the distinguishing boundary

6. The modified program fails to compile before a selected business test runs. How should the result be classified?

Show hint

The intended assertion was never reached.

Show worked solution

Classify this experiment as invalid for detecting the business-rule change, not as a killed behavioral defect. Preserve the build error, restore the disposable baseline, and repair the mutation so the program can execute the selected case. Only then can the assertion’s response to the changed behavior be evaluated.

Check your solution

  • Build failure is recorded separately
  • Business assertion did not execute

7. A selected test fails in unrelated fixture setup after a mutation. Can that establish oracle strength?

Show hint

Inspect the failure reason and reachability.

Show worked solution

No: the test did not reach the business assertion, so its failure does not show that the changed output was detected. Record the setup error and classify the result as inconclusive or invalid under the experiment’s convention. Restore a clean baseline and rerun after addressing the unrelated fixture problem.

Check your solution

  • Fixture failure is distinguished
  • Business assertion was not reached

8. The original test already fails before the deliberate change. What should happen before interpreting the mutation?

Show hint

A clean baseline isolates the change.

Show worked solution

Investigate and resolve or explicitly exclude the baseline failure before attributing any later failure to the mutation. Record the original revision, environment, and selected test outcome. A repeated failure on both versions could have the same pre-existing cause and therefore does not establish mutation detection.

Check your solution

  • Baseline failure is preserved
  • Changed-run failure is not attributed prematurely

9. A changed eligibility value survives because the test asserts only that the response is nonempty. Improve the oracle.

Show hint

Observe the value required by the rule.

Show worked solution

For a distinguishing synthetic score, derive the expected eligible or ineligible value from the approved rule and assert that field explicitly. Keep the response-existence check only if it serves another purpose. Run the improved test on the original baseline first, then repeat the controlled change to see whether the discrepancy is detected.

Check your solution

  • Eligibility value is asserted
  • Improved test passes the original baseline

10. A mutation is in a refund branch but selected tests only read enrollments. What should the survivor prompt?

Show hint

The changed code may be unreachable.

Show worked solution

Inspect coverage or trace evidence to determine whether the selected tests reached the refund branch. Add a valid refund scenario with an independently derived expected amount if that behavior is in scope, then rerun on the clean baseline and the controlled change. A passing read case says little about the unexecuted refund oracle.

Check your solution

  • Refund branch reachability is checked
  • Refund expectation is independent

11. Valid inputs are only 0 and 1. Original x >= 1 changes to x == 1. Classify the change.

Show hint

Evaluate both valid inputs.

Show worked solution

At 0 both expressions are false; at 1 both are true, so they are equivalent on the complete stated domain. Document that domain and reasoning rather than inventing input 2. If the contract later permits 2, reassess because the expressions then differ.

Check your solution

  • Both valid inputs agree
  • Equivalence is scoped to {0,1}

12. The same expressions x >= 1 and x == 1 now support input 2. What changes in the equivalence assessment?

Show hint

Test the newly valid value.

Show worked solution

At x=2 the original expression is true and the equality expression is false, so the change is no longer equivalent on the expanded domain. Derive the expected behavior from the revised contract and add a case if it represents the intended rule. Retain the old equivalence reasoning as historical context.

Check your solution

  • Input 2 is now valid
  • The expressions differ at 2

13. A duplicate guard is removed, but the only selected case submits one claim. Design a distinguishing sequence.

Show hint

The changed behavior concerns a repeat.

Show worked solution

Submit an eligible synthetic claim, then repeat it for the same learner and period under the one-grant rule. Assert the agreed duplicate response and final grant count of one. Run the sequence against the original baseline before the disposable mutation; a first-claim-only case cannot exercise the removed guard.

Check your solution

  • The same claim is repeated
  • Final grant count is one

14. A mutation leaves the error message unchanged but creates two grant rows. Which assertion should be added?

Show hint

Observe the durable side effect.

Show worked solution

Assert that exactly one grant exists for the synthetic learner and period after the repeated request, and check the resulting balance or ledger effect if required. The message-only assertion can pass even when the business invariant is violated. Derive the expected count from the approved once-per-period rule.

Check your solution

  • Grant count is checked
  • A second effect fails the rule

15. Four of eight valid non-equivalent changes are detected. Calculate the simple detected fraction and state its limit.

Show hint

Use the stated denominator only.

Show worked solution

The fraction is 4/8 = 50% for this selected mutation set and test selection. Report the convention, surviving cases, invalid or equivalent changes separately, and the supported domain. This is not a 50% probability that the product is correct and does not measure missing requirements directly.

Check your solution

  • Detected fraction is 50%
  • The score is scoped, not correctness probability

16. A report combines two equivalent changes and one build error with seven behavioral changes in one score. Improve it.

Show hint

Classify outcomes before choosing a denominator.

Show worked solution

List detected, surviving, equivalent, invalid, and inconclusive changes with the test selection and domain. Explain the chosen denominator and calculate a score only for the defined eligible set, if useful. Do not count a syntax failure as a detected business defect or hide equivalent changes in the total without disclosure.

Check your solution

  • Build error is classified invalid
  • Equivalent changes and denominator are explicit

17. A mutation experiment finishes but the original revision cannot be restored. What is the next action?

Show hint

Do not continue with an uncertain working state.

Show worked solution

Stop further experiments, restore the disposable checkout to the recorded original revision, and rerun the normal baseline before interpreting additional results. Investigate the restoration failure and clean up only resources owned by the experiment. Never publish the deliberate mutation as a product fix.

Check your solution

  • Further experiments stop
  • Original baseline is restored and verified

18. A local mutation test uses a provider fake and passes. What integration claim is justified?

Show hint

The substitute limits the boundary observed.

Show worked solution

Report only how the selected test behaved against the configured fake and synthetic input on the recorded build. The real provider’s format, side effects, and network behavior were not observed. Plan a separate authorized isolated contract check if that integration risk matters, and mark it untested until executed.

Check your solution

  • Fake behavior and scope are named
  • Real provider remains untested

19. A surviving change might be equivalent, but the supported rounding domain is undocumented. How should it be recorded?

Show hint

Equivalence needs a defined domain.

Show worked solution

Keep the classification unresolved and ask the rule owner to specify valid precision and rounding behavior. Compare the original and changed expressions across that agreed domain before declaring equivalence or adding a distinguishing case. Do not invent an unsupported input or expectation merely to improve a mutation score.

Check your solution

  • Domain and rounding are unresolved
  • No invented expected result is added

20. You have designed a mutation and expected boundary case but have not run them. What should the report say?

Show hint

A planned experiment has no observed outcome.

Show worked solution

Describe the original rule, deliberate change, selected synthetic input, independent expected result, and disposable environment as planned work. Mark baseline and mutation results not executed, and identify the assertion-strength question still open. Do not classify the change as detected or surviving without an actual run.

Check your solution

  • Experiment is marked planned
  • No detected or surviving result is invented

Key takeaways

  • A mutation experiment tests whether selected checks detect a particular behavioral change.
  • Survivors require investigation and scores require scope.
  • Detection needs a distinguishing input and an assertion that reaches the behavior.
  • A build or fixture failure is not automatically a detected business defect.
  • Equivalence and mutation scores depend on domain, selected tests, and denominator.

Official references