Lune

ASE2021顶会

PyNose: A Test Smell Detector For Python

Tongjie Wang, Yaroslav Golubev, Oleg Smirnov, Jiawei Li, Timofey Bryksin, Iftekhar Ahmed

摘要

Similarly to production code, code smells also occur in test code, where they are called test smells. Test smells have a detrimental effect not only on test code but also on the production code that is being tested. To date, the majority of the research on test smells has been focusing on programming languages such as Java and Scala. However, there are no available automated tools to support the identification of test smells for Python, despite its rapid growth in popularity in recent years. In this paper, we strive to extend the research to Python, build a tool for detecting test smells in this language, and conduct an empirical analysis of test smells in Python projects. We started by gathering a list of test smells from existing research and selecting test smells that can be considered languageagnostic or have similar functionality in Python's standard Unittest framework. In total, we identified 17 diverse test smells. Additionally, we searched for Python-specific test smells by mining frequent code change patterns that can be considered as either fixing or introducing test smells. Based on these changes, we proposed our own test smell called Suboptimal Assert. To detect all these test smells, we developed a tool called PYNOSE in the form of a plugin to PyCharm, a popular Python IDE. Finally, we conducted a large-scale empirical investigation aimed at analyzing the prevalence of test smells in Python code. Our results show that 98% of the projects and 84% of the test suites in the studied dataset contain at least one test smell. Our proposed Suboptimal Assert smell was detected in as much as 70.6% of the projects, making it a valuable addition to the list. Index Terms-Test smells, code smells, Python, empirical studies, code change patterns, mining software repositories 1 To avoid the ambiguity that exists in testing terminology between languages and frameworks, in this paper, we will always refer to individual tests or test methods as test cases and to classes that group them as test suites.

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

已有 8 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。

可以从这些问题问起

Lune 可以查阅

全文 · 引用它的顶会 Paper · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • Unprecedented Code Change Automation: The Fusion of LLMs and Transformation by Example 引用了 PYEVOLVE: Automating Frequent Code Changes in Python ML Systems
  • Unprecedented Code Change Automation: The Fusion of LLMs and Transformation by Example 引用了 From Commit Message Generation to History-Aware Commit Message Completion
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper8

  1. PYEVOLVE: Automating Frequent Code Changes in Python ML SystemsMalinda Dilhara, Danny Dig, Ameya KetkarICSE 2023 · 46 次引用
  2. DynaPyt: a dynamic analysis framework for PythonAryaz Eghbali, Michael PradelFSE 2022 · 30 次引用
  3. The Smelly Eight: An Empirical Study on the Prevalence of Code Smells in Quantum ComputingQihong Chen, Rúben Câmara, José Campos, André Souto 等ICSE 2023 · 23 次引用
  4. From Commit Message Generation to History-Aware Commit Message CompletionAleksandra Eliseeva, Yaroslav Sokolov, Egor Bogomolov, Yaroslav Golubev 等ASE 2023 · 22 次引用
  5. Unprecedented Code Change Automation: The Fusion of LLMs and Transformation by ExampleMalinda Dilhara, Abhiram Bellur, Timofey Bryksin, Danny DigFSE 2024 · 18 次引用

相关 Paper

  1. Making Python code idiomatic by automatic refactoring non-idiomatic Python code with pythonic idiomsZejun Zhang, Zhenchang Xing, Xin Xia, Xiwei Xu 等FSE 2022 · 35 次引用
  2. Towards Effective Static Type-Error Detection for PythonWonseok Oh, Hakjoo OhASE 2024 · 1 次引用
  3. What's DAT Smell? Untangling and Weaving the Disjoint Assertion Tangle Test SmellMonil Narang, Hang Du, James A. JonesASE 2025
  4. Your Build Scripts Stink: The State of Code Smells in Build ScriptsMahzabin Tamanna, Yash Chandrani, Matthew Burrows, Brandon Wroblewski 等ASE 2025 · 1 次引用
  5. Do Automatic Test Generation Tools Generate Flaky Tests?Martin Gruber, Muhammad Firhard Roslan, Owain Parry, Fabian Scharnböck 等ICSE 2024 · 12 次引用
黄昏的海面,两侧是细线勾勒的悬崖