3. Mutation testing
• 関心を持った経緯
座長を担当した,最初の質疑が噛み合わず
• 「ソースを改変して,なぜ良くなるの?」
2つの論文とWebの情報を通じて,面白さを理解
• M. Papadakis and N. Malevris: Killing mutants effectively - a
search based approach, Proc. JCKBSE 2012, pp.217-226,
doi:10.3323/978-1-61499-094-9-217.
• R. Lacanienta, S. Takada, H. Tanno, X. Zhang and T. Hoshino:
A mutation test based approach to evaluating test suites for
Web applications, Proc. JCKBSE 2012, pp.227-236,
doi:10.3323/978-1-61499-094-9-227.
3
4. ソフトウェアテスト
Test suite
Test case 1 Test case 2 ... Test case n
【 ソースコード 】
…
y = x + 1;
…
Output 1 Output 2 ... Output n
出力が期待したものと異なる
⇒ソースコードを修正 4
5. Mutation testing
Test suite
Test case 1 Test case 2 ... Test case n
【 Original 】 1か所だけ 【Mutant】 Mutantは
… 改変 (mutant … 多数作られる
operator) ランダムでは
y = x + 1; y = x – 1; ない
… …
Output 11
Output Output 22
Output ... Output nn
Output
出力が異なる
⇒mutantはkilled 5
6. killできないmutant
• (あるテストケースで)出力が異なる ⇒ killed
• では,出力が同じなら?
• Unkilled mutant
テストスイートを充実させれば,killedになる.
• Equivalent mutant
【 Original 】 【Mutant】
どんなにテストスイートを … …
充実させても,killedに x = y; x = y;
ならない. if (z < y) if (z < x)
例(Lacanienta et al.): … …
6