{"title":"Cognitive Reflection in Software Verification and Testing","authors":"K. Buffardi","doi":"10.1109/ICSE-SEET58685.2023.00006","DOIUrl":null,"url":null,"abstract":"Verifying whether code meets its specifications requires critical thinking and analysis. However, cognitive biases may influence how well software engineers verify and test code. In this paper, I explore cognitive reflection and its association with accurately verifying code via both manual inspection and unit testing. In a two-phase exploratory study of Software Engineering undergraduate students (n=140), I examined their performance on Cognitive Reflection Tests (CRT), manual verification of function implementations, and the accuracy of unit test suites. The first phase found no relationship between CRT and unit test accuracy. However, the higher a student’s CRT score, the more likely they were to reject a defective implementation when inspecting it manually (p<0.0001, 95% CI 1.56-4.50). The second phase replicated the outcomes on an alternate version of the CRT and on a different unit test assignment, revealing a positive correlation between CRT and recognizing defects manually ($\\rho$=0.478, p<0.01). I conclude that cognitive reflection is associated with software engineering students’ aptitude at identifying defects, but is not associated with their affirmation of algorithms without defects, nor with the accuracy of their unit tests.","PeriodicalId":68155,"journal":{"name":"软件产业与工程","volume":"2 1","pages":"1-10"},"PeriodicalIF":0.0000,"publicationDate":"2023-05-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"软件产业与工程","FirstCategoryId":"1089","ListUrlMain":"https://doi.org/10.1109/ICSE-SEET58685.2023.00006","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0
Abstract
Verifying whether code meets its specifications requires critical thinking and analysis. However, cognitive biases may influence how well software engineers verify and test code. In this paper, I explore cognitive reflection and its association with accurately verifying code via both manual inspection and unit testing. In a two-phase exploratory study of Software Engineering undergraduate students (n=140), I examined their performance on Cognitive Reflection Tests (CRT), manual verification of function implementations, and the accuracy of unit test suites. The first phase found no relationship between CRT and unit test accuracy. However, the higher a student’s CRT score, the more likely they were to reject a defective implementation when inspecting it manually (p<0.0001, 95% CI 1.56-4.50). The second phase replicated the outcomes on an alternate version of the CRT and on a different unit test assignment, revealing a positive correlation between CRT and recognizing defects manually ($\rho$=0.478, p<0.01). I conclude that cognitive reflection is associated with software engineering students’ aptitude at identifying defects, but is not associated with their affirmation of algorithms without defects, nor with the accuracy of their unit tests.
验证代码是否符合规范需要批判性思维和分析。然而,认知偏差可能会影响软件工程师验证和测试代码的能力。在本文中,我探索了认知反射及其与通过手工检查和单元测试准确验证代码的关联。在一项针对软件工程本科学生(n=140)的两阶段探索性研究中,我检查了他们在认知反射测试(CRT)、功能实现的手动验证以及单元测试套件的准确性方面的表现。第一阶段发现CRT和单元测试精度之间没有关系。然而,学生的CRT分数越高,在手工检查时,他们越有可能拒绝有缺陷的实现(p<0.0001, 95% CI 1.56-4.50)。第二阶段在CRT的替代版本和不同的单元测试分配上复制了结果,揭示了CRT和手动识别缺陷之间的正相关关系($\rho$=0.478, p<0.01)。我的结论是,认知反射与软件工程学生识别缺陷的能力有关,但与他们对没有缺陷的算法的肯定无关,也与他们的单元测试的准确性无关。