Mutation-Based Approach to Supporting Human–Machine Pair Inspection
Abstract
:1. Introduction
- -
- RQ1. How can an automated approach effectively attract programmers’ attention during the HMPI process to mitigate the overconfidence caused by familiarity with their own code?
- -
- RQ2. How can a mutation-based method be utilized to guide programmers in identifying potential issues in their code during the inspection process?
- -
- RQ3. What metrics can be designed to quantitatively evaluate the effectiveness of code inspections by programmers?
- -
- An automated MB-HMPI method that leverages both human expertise and automated tools is proposed to improve code inspections.
- -
- This framework is the first to use mutants to guide programmers in code inspection, enhancing code quality and the effectiveness of inspections.
- -
- Two novel metrics—the Mutation Detection Rate (MDR) and Code Modification Rate (CMR)—are proposed to quantitatively assess the quality of a programmer’s code inspection. The MDR measures the effectiveness of identifying injected mutants, while the CMR evaluates the extent of code modifications made by the programmer to address identified issues.
2. Background
2.1. Related Work
2.2. Motivations and Strengths
3. Methodology
3.1. Foundational Techniques
3.1.1. Human–Machine Pair Inspection
3.1.2. Mutation Testing
3.1.3. Tree Edit Distance
3.2. General Workflow
- -
- The AST is traversed according to a given set of rules, and the nodes requiring modification are identified.
- -
- The identified nodes are modified according to the specified patterns, as illustrated in the red box in Figure 4.
- -
- The modified AST is recompiled into mutants, which are then provided to programmers for inspection and evaluation.
- -
- The inspection passes, and the programmers continue with development.
- -
- The fixed code undergoes another round of mutation, generating new mutated code for further inspection by the programmers.
- -
- The inspection fails, and the programmers continue inspecting the mutated code. The specific comparison strategy and implementation method are provided in Section 3.5.
3.3. Mutation Model
3.3.1. Defect-Based Mutation Operators
3.3.2. Mutation Rule
Listing 1. Original code. |
Listing 2. The mutant. |
3.4. Automatic Mutant Generation
Algorithm 1: Location. |
Algorithm 2: Mutant. |
3.5. Code Comparison Strategy
4. Results and Discussion
4.1. Case Study 1
- -
- Step 1: Generate the mutant
Listing 3. Source code containing potential errors. |
- -
- Step 2: Code inspection of the mutant
Listing 4. The code after inserting mutants. |
- -
- Step 3: Re-mutation
Listing 5. Optimized code. |
4.2. Case Study 2
Listing 6. Python code for parsing. |
4.3. Experiments
- -
- Programming Time: The total time spent by the programmer in writing the code.
- -
- Execution duration: The time taken for the code to run during testing.
- -
- Submission count: The number of times the programmer submitted the code to the system for verification.
4.4. Experimental Results
4.5. Responses to Research Questions
- -
- RQ1. How can an automated approach effectively attract programmers’ attention during the HMPI process to mitigate the overconfidence caused by familiarity with their own code?
- -
- A1. Our proposed MB-HMPI approach leverages human expertise through integrating mutation-based techniques to strategically guide programmers’ attention to specific components of the code. Utilizing mutation operators derived from historical defects and applying automated AST-based mutant generation, the approach ensures that code inspection remains focused, efficient, and less prone to oversights.
- -
- RQ2. How can a mutation-based method be utilized to guide programmers in identifying potential issues in their code during the inspection process?
- -
- A2. The mutation-based method generates mutants that simulate common logical and structural errors, enabling programmers to identify potential flaws during the inspection process. Through combining deliberate fault injection and structured inspection strategies, programmers are guided toward uncovering hidden issues in their code that might otherwise be missed.
- -
- RQ3. What metrics can be designed to quantitatively evaluate the effectiveness of code inspections by programmers?
- -
- A3. We introduce two novel metrics: the Mutation Detection Rate (MDR) and Code Modification Rate (CMR). The MDR measures the programmer’s ability to detect and repair inserted mutations, while the CMR evaluates the extent to which programmers refine the original source code based on the inspection process. These metrics provide a robust quantitative assessment of the effectiveness of code inspections conducted through MB-HMPI.
4.6. Implications, Limitations, and Future Prospects
5. Conclusions
Author Contributions
Funding
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Badampudi, D.; Unterkalmsteiner, M.; Britto, R. Modern code reviews—Survey of literature and practice. ACM Trans. Softw. Eng. Methodol. 2023, 32, 1–61. [Google Scholar] [CrossRef]
- Fagan, M. Design and code inspections to reduce errors in program development. In Software Pioneers: Contributions to Software Engineering; Springer: Berlin/Heidelberg, Germany, 2011; pp. 575–607. [Google Scholar]
- Ackerman, A.F.; Buchwald, L.S.; Lewski, F.H. Software inspections: An effective verification process. IEEE Softw. 1989, 6, 31–36. [Google Scholar] [CrossRef]
- Sadowski, C.; Söderberg, E.; Church, L.; Sipko, M.; Bacchelli, A. Modern code review: A case study at google. In Proceedings of the 40th International Conference on Software Engineering: Software Engineering in Practice, ICSE (SEIP) 2018, Gothenburg, Sweden, 27 May–3 June 2018; Paulisch, F., Bosch, J., Eds.; ACM: New York, NY, USA, 2018; pp. 181–190. [Google Scholar] [CrossRef]
- Wessel, M.S.; Serebrenik, A.; Wiese, I.; Steinmacher, I.; Gerosa, M.A. Effects of Adopting Code Review Bots on Pull Requests to OSS Projects. In Proceedings of the IEEE International Conference on Software Maintenance and Evolution, ICSME 2020, Adelaide, Australia, 28 September–2 October 2020; pp. 1–11. [Google Scholar] [CrossRef]
- McIntosh, S.; Kamei, Y.; Adams, B.; Hassan, A.E. The impact of code review coverage and code review participation on software quality: A case study of the qt, VTK, and ITK projects. In Proceedings of the 11th Working Conference on Mining Software Repositories, Hyderabad, India, 31 May–1 June 2014; pp. 192–201. [Google Scholar]
- Wessel, M.S.; Serebrenik, A.; Wiese, I.; Steinmacher, I.; Gerosa, M.A. What to Expect from Code Review Bots on GitHub?: A Survey with OSS Maintainers. In Proceedings of the 34th Brazilian Symposium on Software Engineering, SBES 2020, Natal, Brazil, 19–23 October 2020; Cavalcante, E., Dantas, F., Batista, T., Eds.; ACM: New York, NY, USA, 2020; pp. 457–462. [Google Scholar] [CrossRef]
- Wurzel Gonçalves, P.; Calikli, G.; Serebrenik, A.; Bacchelli, A. Competencies for code review. Proc. ACM Hum.-Comput. Interact. 2023, 7, 1–33. [Google Scholar] [CrossRef]
- Dai, Y.; Liu, S. Applying Cognitive Complexity to Checklist-Based Human-Machine Pair Inspection. In Proceedings of the 21st IEEE International Conference on Software Quality, Reliability and Security, QRS 2021—Companion, Hainan Island, China, 6–10 December 2021; pp. 314–318. [Google Scholar] [CrossRef]
- Natella, R.; Cotroneo, D.; Madeira, H.S. Assessing dependability with software fault injection: A survey. ACM Comput. Surv. (CSUR) 2016, 48, 1–55. [Google Scholar] [CrossRef]
- Duraes, J.A.; Madeira, H.S. Emulation of software faults: A field data study and a practical approach. IEEE Trans. Softw. Eng. 2006, 32, 849–867. [Google Scholar] [CrossRef]
- Charoenwet, W.; Thongtanunam, P.; Pham, V.; Treude, C. An Empirical Study of Static Analysis Tools for Secure Code Review. In Proceedings of the 33rd ACM SIGSOFT International Symposium on Software Testing and Analysis, ISSTA 2024, Vienna, Austria, 16–20 September 2024; Christakis, M., Pradel, M., Eds.; ACM: New York, NY, USA, 2024; pp. 691–703. [Google Scholar] [CrossRef]
- Singh, D.; Sekar, V.R.; Stolee, K.T.; Johnson, B. Evaluating how static analysis tools can reduce code review effort. In Proceedings of the 2017 IEEE Symposium on Visual Languages and Human-Centric Computing, VL/HCC 2017, Raleigh, NC, USA, 11–14 October 2017; Henley, A.Z., Rogers, P., Sarma, A., Eds.; IEEE Computer Society: Piscataway, NJ, USA, 2017; pp. 101–105. [Google Scholar] [CrossRef]
- Tufano, R.; Pascarella, L.; Tufano, M.; Poshyvanyk, D.; Bavota, G. Towards automating code review activities. In Proceedings of the 2021 IEEE/ACM 43rd International Conference on Software Engineering (ICSE), Madrid, Spain, 22–30 May 2021; pp. 163–174. [Google Scholar]
- Li, Z.; Lu, S.; Guo, D.; Duan, N.; Jannu, S.; Jenks, G.; Majumder, D.; Green, J.; Svyatkovskiy, A.; Fu, S.; et al. Automating code review activities by large-scale pre-training. In Proceedings of the 30th ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering, Singapore, 14–18 November 2022; pp. 1035–1047. [Google Scholar]
- Tufano, R.; Masiero, S.; Mastropaolo, A.; Pascarella, L.; Poshyvanyk, D.; Bavota, G. Using pre-trained models to boost code review automation. In Proceedings of the 44th International Conference on Software Engineering, Pittsburgh, PA, USA, 21–29 May 2022; pp. 2291–2302. [Google Scholar]
- Bacchelli, A.; Bird, C. Expectations, outcomes, and challenges of modern code review. In Proceedings of the 2013 35th International Conference on Software Engineering (ICSE), San Francisco, CA, USA, 18–26 May 2013; pp. 712–721. [Google Scholar]
- Davila, N.; Nunes, I. A systematic literature review and taxonomy of modern code review. J. Syst. Softw. 2021, 177, 110951. [Google Scholar] [CrossRef]
- Papadakis, M.; Kintis, M.; Zhang, J.; Jia, Y.; Le Traon, Y.; Harman, M. Mutation testing advances: An analysis and survey. In Advances in Computers; Elsevier: Amsterdam, The Netherlands, 2019; Volume 112, pp. 275–378. [Google Scholar]
- Ziade, H.; Ayoubi, R.A.; Velazco, R. A survey on fault injection techniques. Int. Arab J. Inf. Technol. 2004, 1, 171–186. [Google Scholar]
- Loise, T.; Devroey, X.; Perrouin, G.; Papadakis, M.; Heymans, P. Towards Security-Aware Mutation Testing. In Proceedings of the 2017 IEEE International Conference on Software Testing, Verification and Validation Workshops, ICST Workshops 2017, Tokyo, Japan, 13–17 March 2017; IEEE Computer Society: Piscataway, NJ, USA, 2017; pp. 97–102. [Google Scholar] [CrossRef]
- Nanavati, J.; Wu, F.; Harman, M.; Jia, Y.; Krinke, J. Mutation testing of memory-related operators. In Proceedings of the 2015 IEEE Eighth International Conference on Software Testing, Verification and Validation Workshops (ICSTW), Graz, Austria, 3–17 April 2015; IEEE Computer Society: Piscataway, NJ, USA, 2015; pp. 1–10. [Google Scholar] [CrossRef]
- Wu, F.; Nanavati, J.; Harman, M.; Jia, Y.; Krinke, J. Memory mutation testing. Inf. Softw. Technol. 2017, 81, 97–111. [Google Scholar] [CrossRef]
- Garvin, B.J.; Cohen, M.B. Feature Interaction Faults Revisited: An Exploratory Study. In Proceedings of the IEEE 22nd International Symposium on Software Reliability Engineering, ISSRE 2011, Hiroshima, Japan, 29 November–2 December 2011; Dohi, T., Cukic, B., Eds.; IEEE Computer Society: Piscataway, NJ, USA, 2011; pp. 90–99. [Google Scholar] [CrossRef]
- Kao, W.I.; Iyer, R.K.; Tang, D. FINE: A fault injection and monitoring environment for tracing the UNIX system behavior under faults. IEEE Trans. Softw. Eng. 1993, 19, 1105–1118. [Google Scholar] [CrossRef]
- Kao, W.L.; Iyer, R. DEFINE: A distributed fault injection and monitoring environment. In Proceedings of the IEEE Workshop on Fault-Tolerant Parallel and Distributed Systems, College Station, TX, USA, 12–14 June 1996; pp. 252–259. [Google Scholar]
- Stott, D.T.; Floering, B.; Burke, D.; Kalbarczpk, Z.; Iyer, R.K. NFTAPE: A framework for assessing dependability in distributed systems with lightweight fault injectors. In Proceedings of the IEEE International Computer Performance and Dependability Symposium, IPDS 2000, Chicago, IL, USA, 27–29 March 2000; pp. 91–100. [Google Scholar]
- Cotroneo, D.; Natella, R.; Russo, S.; Scippacercola, F. State-driven testing of distributed systems. In Proceedings of the Principles of Distributed Systems: 17th International Conference, OPODIS 2013, Nice, France, 16–18 December 2013; Proceedings 17. Springer: Berlin/Heidelberg, Germany, 2013; pp. 114–128. [Google Scholar]
- Daran, M.; Thévenod-Fosse, P. Software error analysis: A real case study involving real faults and mutations. ACM SIGSOFT Softw. Eng. Notes 1996, 21, 158–171. [Google Scholar] [CrossRef]
- Ng, W.T.; Chen, P.M. The design and verification of the Rio file cache. IEEE Trans. Comput. 2001, 50, 322–337. [Google Scholar] [CrossRef]
- Thongtanunam, P.; Tantithamthavorn, C.; Kula, R.G.; Yoshida, N.; Iida, H.; Matsumoto, K. Who should review my code? A file location-based code-reviewer recommendation approach for Modern Code Review. In Proceedings of the 22nd IEEE International Conference on Software Analysis, Evolution, and Reengineering, SANER 2015, Montreal, QC, Canada, 2–6 March 2015; Guéhéneuc, Y., Adams, B., Serebrenik, A., Eds.; IEEE Computer Society: Piscataway, NJ, USA, 2015; pp. 141–150. [Google Scholar] [CrossRef]
- Ruangwan, S.; Thongtanunam, P.; Ihara, A.; Matsumoto, K. The impact of human factors on the participation decision of reviewers in modern code review. Empir. Softw. Eng. 2019, 24, 973–1016. [Google Scholar] [CrossRef]
- Mohanani, R.; Salman, I.; Turhan, B.; Rodríguez, P.; Ralph, P. Cognitive biases in software engineering: A systematic mapping study. IEEE Trans. Softw. Eng. 2018, 46, 1318–1339. [Google Scholar] [CrossRef]
- Liu, S. Software Construction Monitoring and Predicting for Human-Machine Pair Programming. In Proceedings of the Structured Object-Oriented Formal Language and Method—8th International Workshop, SOFL+MSVL 2018, Gold Coast, QLD, Australia, 16 November 2018; Duan, Z., Liu, S., Tian, C., Nagoya, F., Eds.; Revised Selected Papers; Lecture Notes in Computer Science. Springer: Berlin/Heidelberg, Germany, 2018; Volume 11392, pp. 3–20. [Google Scholar] [CrossRef]
- Campbell, G.A. Cognitive Complexity—A new way of measuring understandability. SonarSource SA 2018, 10. [Google Scholar]
- Jia, Y.; Harman, M. An analysis and survey of the development of mutation testing. IEEE Trans. Softw. Eng. 2010, 37, 649–678. [Google Scholar] [CrossRef]
- Offutt, A.J.; Pan, J. Automatically detecting equivalent mutants and infeasible paths. Softw. Test. Verif. Reliab. 1997, 7, 165–192. [Google Scholar] [CrossRef]
- Tai, K.C. The tree-to-tree correction problem. J. ACM (JACM) 1979, 26, 422–433. [Google Scholar] [CrossRef]
- Zhang, K.; Shasha, D. Simple fast algorithms for the editing distance between trees and related problems. SIAM J. Comput. 1989, 18, 1245–1262. [Google Scholar] [CrossRef]
- Zhang, K. A constrained edit distance between unordered labeled trees. Algorithmica 1996, 15, 205–222. [Google Scholar] [CrossRef]
- Oladele, R.; Adedayo, H. On empirical comparison of checklist-based reading and adhoc reading for code inspection. Int. J. Comput. Appl. 2014, 87. [Google Scholar] [CrossRef]
Construct | Keywords | Operators |
---|---|---|
Sequence Structure |
|
|
Selection Structure |
|
|
Iteration Structure |
|
|
Keywords | Mutations | Example |
---|---|---|
For |
|
|
If-else |
|
|
Re-mutation | Re-mutation | |
Continue | Inspection |
Phase | Group | Participant | Problem | Task | Recorded Data |
---|---|---|---|---|---|
1 | 1 | 1 | 1, 2 | Programming independently without code inspection |
|
2 | 2 | 1, 2 | |||
3 | 3 | 1, 2 | |||
4 | 4 | 1, 2 | |||
2 | A | 1 | 3, 4 | Programming |
|
2 | Inspection | ||||
B | 3 | 5, 6 | Programming | ||
4 | Inspection | ||||
A’ | 1 | 7, 8 | Inspection | ||
2 | Programming | ||||
B’ | 3 | 9, 10 | Inspection | ||
4 | Programming | ||||
3 | A | 1 | 11, 12 | Programming |
|
2 | Machine’s role | ||||
B | 3 | 13, 14 | Programming | ||
4 | Machine’s role | ||||
A’ | 1 | 15, 16 | Machine’s role | ||
2 | Programming | ||||
B’ | 3 | 17, 18 | Machine’s role | ||
4 | Programming |
Participant | Problem | Programming Time (min) | Execution Duration (ms) | Submission Count |
---|---|---|---|---|
1 | 1 | 32 | 37 | 7 |
2 | 25 | 31 | 5 | |
2 | 1 | 27 | 19 | 4 |
2 | 20 | 24 | 2 | |
3 | 1 | 43 | 56 | 9 |
2 | 36 | 47 | 7 | |
4 | 1 | 20 | 18 | 3 |
2 | 16 | 17 | 2 |
Group | Programmer | Problem | Programming Time (min) | Inspection Time (min) | Execution Duration (ms) | Submission Count |
---|---|---|---|---|---|---|
A | 1 | 3 | 28 | 13 | 32 | 5 |
4 | 34 | 11 | 35 | 5 | ||
B | 3 | 5 | 46 | 10 | 46 | 7 |
6 | 40 | 9 | 38 | 6 | ||
A’ | 2 | 7 | 24 | 15 | 18 | 3 |
8 | 31 | 14 | 20 | 2 | ||
B’ | 4 | 9 | 19 | 16 | 17 | 2 |
10 | 21 | 15 | 14 | 2 |
Group | Programmer | Problem | Programming Time (min) | Execution Duration (ms) | Submission Count |
---|---|---|---|---|---|
A | 1 | 11 | 36 | 30 | 4 |
12 | 40 | 33 | 3 | ||
B | 3 | 13 | 45 | 36 | 5 |
14 | 57 | 43 | 6 | ||
A’ | 2 | 15 | 32 | 19 | 2 |
16 | 37 | 17 | 2 | ||
B’ | 4 | 17 | 28 | 12 | 1 |
18 | 30 | 15 | 2 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Dai, Y.; Liu, S.; Liu, H. Mutation-Based Approach to Supporting Human–Machine Pair Inspection. Electronics 2025, 14, 382. https://doi.org/10.3390/electronics14020382
Dai Y, Liu S, Liu H. Mutation-Based Approach to Supporting Human–Machine Pair Inspection. Electronics. 2025; 14(2):382. https://doi.org/10.3390/electronics14020382
Chicago/Turabian StyleDai, Yujun, Shaoying Liu, and Haiyi Liu. 2025. "Mutation-Based Approach to Supporting Human–Machine Pair Inspection" Electronics 14, no. 2: 382. https://doi.org/10.3390/electronics14020382
APA StyleDai, Y., Liu, S., & Liu, H. (2025). Mutation-Based Approach to Supporting Human–Machine Pair Inspection. Electronics, 14(2), 382. https://doi.org/10.3390/electronics14020382