[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-detail-82315-en":3,"doc-seo-82315-105":29,"detail-sidebar-cat-0-en-105":91},{"code":4,"msg":5,"data":6},0,"success",{"doc_id":7,"user_id":8,"nickname":9,"user_avatar":10,"doc_module":4,"category_id":11,"category_name":12,"doc_title":13,"doc_description":14,"doc_content":15,"file_id":16,"file_url":17,"file_type":18,"file_size":19,"view_count":20,"is_deleted":4,"is_public":20,"is_downloadable":20,"audit_status":20,"page_count":21,"language":22,"language_code":23,"site_id":24,"html_lang":23,"table_of_contents":25,"faqs":26,"seo_title":13,"seo_description":14,"update_tm":27,"read_time":28},82315,1374391974564,"Clementine","https://ap-avatar.wpscdn.com/avatar/14000253aa45c000a9e?x-image-process=image/resize,m_fixed,w_180,h_180&k=1779874745381141002",8,"Research & Report","How Far Are We from Detecting Flaky Tests? On the Limits of Code-Based Detection","Flaky tests pass and fail on the same code version, weakening the signal of test outcomes and disrupting continuous integration pipelines. Although code-based flakiness detectors achieve strong benchmark scores, practical adoption remains limited. The work argues that flakiness is not a static property of test source code and that many benchmarks inflate F1 via shortcuts and evaluation choices. It builds controlled datasets (including CI-mined cases) and reframes prediction around whether an observed failure is flaky and how environment affects failure probability.","How Far Are We from Detecting Flaky Tests? On the Limits of Code-Based Detection  \n¨Omer Oktay G¨ultekin 1 , Alexander Berndt 1,3 , Jonathan Bell 2 , Thomas Bach 3 , and Sebastian Baltes 1  \n1Heidelberg University, Germany 2Northeastern University, USA 3 SAP, Germany  \noemer.gueltekin@stud.uni-heidelberg.de, alexander.berndt@uni-heidelberg.de, [j.bell@northeastern.edu](j.bell@northeastern.edu), [thomas.bach03@sap.com](thomas.bach03@sap.com), sebastian.baltes@uni-heidelberg.de  \narXiv :2607 .09345v 1 [ cs . SE] 10 Jul 2026  \nAbstract—Flaky tests pass and fail on the same code version, weakening the signal of test results and disrupting continuous integration (CI) pipelines. Code-based flakiness detectors report strong benchmark results, yet their use in practice remains limited. We argue that the field is studying the wrong problem: Flakiness is not a static property of test code, which often lacks the information needed to decide whether a test is flaky. Analyzing three code-based detectors operating on test code, we found that widely used benchmarks contain shortcuts that inflate reported F1 scores and that evaluation protocols overstate generalizability. To control for these shortcuts, we curated two datasets. The first, C-IDoFT (54468 unit tests from 57 GitHub projects), keeps a developer-confirmed subset of IDoFT’s flaky tests and rebuilds only the non-flaky class from repeated executions instead of fixed versions of flaky tests. C-IDoFT is a controlled counterfactual, not a benchmark for reuse. Our CodeBERT reimplementations of two published detectors scored far above its constant baselines under the published crossvalidation protocol but no better than them once projects were separated. The high scores rested on the labeling shortcut and the evaluation protocol, not on the test code. On FlakeBench, a benchmark restricted to flakiness types typically recognizable from test code, and the same project-disjoint protocol, the models identified nearly all flaky tests. The second dataset, mined from CI logs, contains 86 flaky end-to-end tests that passed and failed on the same commit. The test code and CI log yielded a cause for 42% of them; the other 58% required further execution evidence. Rather than abandoning flakiness prediction, we reframe it around whether an observed failure is flaky and how likely a test is to fail given its execution environment. Our datasets and CI-mining method support this direction.  \nI. INTRODUCTION  \nFlaky tests impede continuous integration (CI) . Flaky tests pass and fail on the same version of the code, so their failures no longer reliably signal a software defect [1] . Thus, flaky tests waste developer time spent debugging spurious failuresand erode trust in test results [2] . The common mitigation is to repeatedly re-execute failing tests in the CI pipeline to separate flaky failures from real ones. Companies such as Google rely on this to keep flaky failures from blocking their pipelines [3], and Meta reports that flakiness reduces test effectiveness and increases the cost of testing [4]. However, repeatedly executing flaky tests is expensive at scale, and at Google flaky testseven undermine rerun-based test selection heuristics [5] . For example, practitioners at SAP report that 500 hours of compute per day go to rerun-based handling of flaky failures during SAP HANA pre-submit testing on the main branch alone [6] .  \nTo avoid the cost of repeatedly executing flaky tests, a large body of work tries to detect flaky tests statically, without reruns, using signals such as the test execution history [3, 7, 8], code metrics [9], or combinations of metrics and the test code [10] . The most actively studied approach is code-based detection, where a model is trained on a test’s source code to predict whether it is flaky, ranging from Pinto et al.’s lexical approach and follow-up vocabulary studies [11–14] through feature-based and fine-tuned code models [15–17] to recent methods based on Large L","cbCaiev0CSelUEJh","https://ap.wps.com/l/cbCaiev0CSelUEJh","pdf",347492,1,15,"English","en",105,"# Introduction\n## Background and problem motivation\n## Limits of code-based detection\n## Study approach and contributions","[{\"question\":\"Why are flaky tests harmful to continuous integration?\",\"answer\":\"Flaky tests pass and fail on the same code version, so failures no longer reliably indicate real defects. This wastes developer time and erodes trust in test results.\"},{\"question\":\"What is the main critique of code-based flakiness detection?\",\"answer\":\"Flakiness is not a static property of test source code; it emerges from how the test interacts with the system and its execution environment. Therefore, deciding whether a test is flaky from code alone is often ill-posed.\"},{\"question\":\"How do the authors evaluate and control the shortcomings of existing benchmarks?\",\"answer\":\"They reproduce multiple code-based detectors and find benchmark shortcuts and overly optimistic evaluation protocols. They then curate controlled counterfactual datasets (e.g., C-IDoFT) and also use a project-disjoint protocol on flake-focused benchmarks and CI-mined end-to-end failures.\"}]",1784179561,38,{"code":4,"msg":30,"data":31},"ok",{"site_id":24,"language":23,"slug":32,"title":13,"keywords":33,"description":14,"schema_data":34,"social_meta":86,"head_meta":88,"extra_data":90,"updated_unix":27},"how-far-are-we-from-detecting-flaky-tests-on-the-limits-of-code-based-detection","",{"@graph":35,"@context":85},[36,53,68],{"@type":37,"itemListElement":38},"BreadcrumbList",[39,43,47,50],{"item":40,"name":41,"@type":42,"position":20},"https://docshare.wps.com","Home","ListItem",{"item":44,"name":45,"@type":42,"position":46},"https://docshare.wps.com/document/","Document",2,{"item":48,"name":12,"@type":42,"position":49},"https://docshare.wps.com/document/research-report/",3,{"item":51,"name":13,"@type":42,"position":52},"https://docshare.wps.com/document/how-far-are-we-from-detecting-flaky-tests-on-the-limits-of-code-based-detection/82315/",4,{"url":51,"name":13,"@type":54,"author":55,"headline":13,"publisher":57,"fileFormat":60,"inLanguage":23,"description":14,"dateModified":61,"datePublished":62,"encodingFormat":60,"isAccessibleForFree":63,"interactionStatistic":64},"DigitalDocument",{"name":9,"@type":56},"Person",{"url":40,"name":58,"@type":59},"DocShare","Organization","application/pdf","2026-07-17","2026-07-16",true,{"@type":65,"interactionType":66,"userInteractionCount":20},"InteractionCounter",{"@type":67},"ViewAction",{"@type":69,"mainEntity":70},"FAQPage",[71,77,81],{"name":72,"@type":73,"acceptedAnswer":74},"Why are flaky tests harmful to continuous integration?","Question",{"text":75,"@type":76},"Flaky tests pass and fail on the same code version, so failures no longer reliably indicate real defects. This wastes developer time and erodes trust in test results.","Answer",{"name":78,"@type":73,"acceptedAnswer":79},"What is the main critique of code-based flakiness detection?",{"text":80,"@type":76},"Flakiness is not a static property of test source code; it emerges from how the test interacts with the system and its execution environment. Therefore, deciding whether a test is flaky from code alone is often ill-posed.",{"name":82,"@type":73,"acceptedAnswer":83},"How do the authors evaluate and control the shortcomings of existing benchmarks?",{"text":84,"@type":76},"They reproduce multiple code-based detectors and find benchmark shortcuts and overly optimistic evaluation protocols. They then curate controlled counterfactual datasets (e.g., C-IDoFT) and also use a project-disjoint protocol on flake-focused benchmarks and CI-mined end-to-end failures.","https://schema.org",{"og:url":51,"og:type":87,"og:title":13,"og:site_name":58,"og:description":14},"article",{"robots":89,"canonical":51},"index,follow",{"doc_id":7,"site_id":24},{"code":4,"msg":5,"data":92},[93,97,101,105,110,115,120,123,128,131,135],{"id":20,"doc_module":4,"doc_module_name":45,"category_name":94,"show_sort_weight":95,"slug":96},"Story & Novel",90,"story-novel",{"id":46,"doc_module":4,"doc_module_name":45,"category_name":98,"show_sort_weight":99,"slug":100},"Literature",80,"literature",{"id":52,"doc_module":4,"doc_module_name":45,"category_name":102,"show_sort_weight":103,"slug":104},"Exam",70,"exam",{"id":106,"doc_module":4,"doc_module_name":45,"category_name":107,"show_sort_weight":108,"slug":109},5,"Comic",60,"comic",{"id":111,"doc_module":4,"doc_module_name":45,"category_name":112,"show_sort_weight":113,"slug":114},6,"Technology",50,"technology",{"id":116,"doc_module":4,"doc_module_name":45,"category_name":117,"show_sort_weight":118,"slug":119},7,"Healthcare",40,"healthcare",{"id":11,"doc_module":4,"doc_module_name":45,"category_name":12,"show_sort_weight":121,"slug":122},30,"research-report",{"id":124,"doc_module":4,"doc_module_name":45,"category_name":125,"show_sort_weight":126,"slug":127},9,"Religion & Spirituality",20,"religion-spirituality",{"id":126,"doc_module":4,"doc_module_name":45,"category_name":129,"show_sort_weight":126,"slug":130},"World Cup","world-cup",{"id":132,"doc_module":4,"doc_module_name":45,"category_name":133,"show_sort_weight":132,"slug":134},10,"Lifestyle","lifestyle",{"id":136,"doc_module":4,"doc_module_name":45,"category_name":137,"show_sort_weight":106,"slug":138},19,"General","general"]