{"title":"From Open Source to Industry: A Replication Study of AAA Test Structure in Envestnet","authors":"Chenhao Wei;Sunny Wong;Lu Xiao","doi":"10.1109/TSE.2026.3710992","DOIUrl":null,"url":null,"abstract":"The Arrange-Act-Assert (AAA) pattern, a unified structure for organizing unit tests, is widely recognized for better comprehension and maintenance of tests. However, its adoption in commercial software development remains insufficiently understood. This study investigates how the AAA pattern is practiced in industrial settings by examining test cases from Envestnet Inc. (ENV), adapting automated AAA tagging techniques, and comparing AAA-related issues between commercial and open-source software (OSS) projects. We enhanced a machine learning-based AAA tagging model, previously applied to OSS, to suit ENV domain-specific codebases. We then analyzed AAA adherence and issue distribution across three ENV projects, followed by developer interviews to uncover root causes and assess refactoring strategies. The adapted tagging model achieved F1 scores of 0.75, 0.77, and 0.73 for Arrangement, Action, and Assertion, respectively. Compared with seven open-source projects (25.17%), ENV projects exhibited a significantly lower prevalence of AAA issues (15.68%, <inline-formula><tex-math>$\\boldsymbol{p}\\,\\mathbf{=\\,0.034}$</tex-math></inline-formula>, Cohen’s <inline-formula><tex-math>$\\boldsymbol{d}\\,\\mathbf{=\\,1.64}$</tex-math></inline-formula>). Interviews with developers further illuminated the underlying causes of these violations—such as production–test co-evolution and unfamiliarity with certain testing APIs—and highlighted nuanced refactoring strategies that carefully balance structural consistency, code clarity, and test performance. These nuances, however, did not emerge in our earlier investigations of open-source projects. This study demonstrates that incorporating domain-specific data to fine-tune pre-trained models like CodeBERT, alongside context-aware features, enables accurate AAA analysis. ENV projects have significantly fewer AAA issues than OSS, with distinct patterns such as the absence of Multiple Acts and the prevalence of Assert Precondition. Developer interviews reveal practical motivations behind AAA deviations and inform context-sensitive refactoring strategies. These findings provide actionable guidance for improving test structure and developing automated refactoring tools in practice.","PeriodicalId":13324,"journal":{"name":"IEEE Transactions on Software Engineering","volume":"52 10","pages":"3214-3234"},"PeriodicalIF":6.0000,"publicationDate":"2026-10-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"IEEE Transactions on Software Engineering","FirstCategoryId":"94","ListUrlMain":"https://ieeexplore.ieee.org/document/11596584/","RegionNum":1,"RegionCategory":"计算机科学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"2026/7/7 0:00:00","PubModel":"Epub","JCR":"Q1","JCRName":"COMPUTER SCIENCE, SOFTWARE ENGINEERING","Score":null,"Total":0}
引用次数: 0
Abstract
The Arrange-Act-Assert (AAA) pattern, a unified structure for organizing unit tests, is widely recognized for better comprehension and maintenance of tests. However, its adoption in commercial software development remains insufficiently understood. This study investigates how the AAA pattern is practiced in industrial settings by examining test cases from Envestnet Inc. (ENV), adapting automated AAA tagging techniques, and comparing AAA-related issues between commercial and open-source software (OSS) projects. We enhanced a machine learning-based AAA tagging model, previously applied to OSS, to suit ENV domain-specific codebases. We then analyzed AAA adherence and issue distribution across three ENV projects, followed by developer interviews to uncover root causes and assess refactoring strategies. The adapted tagging model achieved F1 scores of 0.75, 0.77, and 0.73 for Arrangement, Action, and Assertion, respectively. Compared with seven open-source projects (25.17%), ENV projects exhibited a significantly lower prevalence of AAA issues (15.68%, $\boldsymbol{p}\,\mathbf{=\,0.034}$, Cohen’s $\boldsymbol{d}\,\mathbf{=\,1.64}$). Interviews with developers further illuminated the underlying causes of these violations—such as production–test co-evolution and unfamiliarity with certain testing APIs—and highlighted nuanced refactoring strategies that carefully balance structural consistency, code clarity, and test performance. These nuances, however, did not emerge in our earlier investigations of open-source projects. This study demonstrates that incorporating domain-specific data to fine-tune pre-trained models like CodeBERT, alongside context-aware features, enables accurate AAA analysis. ENV projects have significantly fewer AAA issues than OSS, with distinct patterns such as the absence of Multiple Acts and the prevalence of Assert Precondition. Developer interviews reveal practical motivations behind AAA deviations and inform context-sensitive refactoring strategies. These findings provide actionable guidance for improving test structure and developing automated refactoring tools in practice.
期刊介绍:
IEEE Transactions on Software Engineering seeks contributions comprising well-defined theoretical results and empirical studies with potential impacts on software construction, analysis, or management. The scope of this Transactions extends from fundamental mechanisms to the development of principles and their application in specific environments. Specific topic areas include:
a) Development and maintenance methods and models: Techniques and principles for specifying, designing, and implementing software systems, encompassing notations and process models.
b) Assessment methods: Software tests, validation, reliability models, test and diagnosis procedures, software redundancy, design for error control, and measurements and evaluation of process and product aspects.
c) Software project management: Productivity factors, cost models, schedule and organizational issues, and standards.
d) Tools and environments: Specific tools, integrated tool environments, associated architectures, databases, and parallel and distributed processing issues.
e) System issues: Hardware-software trade-offs.
f) State-of-the-art surveys: Syntheses and comprehensive reviews of the historical development within specific areas of interest.