Roslan, M.F., Rojas, J.M. and McMinn, P. orcid.org/0000-0001-9137-7433 (2024) Viscount: a direct method call coverage tool for Java. In: 2024 IEEE International Conference on Software Maintenance and Evolution (ICSME). 40th International Conference on Software Maintenance and Evolution (ICSME 2024), 06-11 Oct 2024, Flagstaff, AZ, USA. Institute of Electrical and Electronics Engineers (IEEE) , pp. 908-912. ISBN 979-8-3503-9568-6
Abstract
Writing unit tests against implementation detail in production code, often embodied in non-public methods, is considered bad practice in formal and gray literature. This is because it leads to fragile tests that break easily when underlying implementation details change. For this reason, tests that focus on behavior are encouraged. One way to achieve this is to test units exclusively through their public API. However, our recent developer survey shows that this advice is not always followed in practice. Moreover, code coverage tools do not provide a way to determine which methods were called directly from tests, meaning there is no easy way to identify whether units make calls to non-public methods, other than through manual examination. To address this problem, we developed Viscount, a tool that can determine direct method call coverage for Java tests written in JUnit. Viscount reports the percentage of methods invoked directly from tests, according to their visibility — i.e., public or non-public (protected, package-private, or private). This can help developers and researchers identify tests that potentially need to be refactored or rewritten. In this paper, we describe Viscount’s overall architecture, its core features, and how to use it. Viscount is also publicly available on GitHub: https://github.com/unittesting-nonpublic/viscount. A demo video of Viscount is available at: https://youtu.be/ZUyRtiUnbsU.
Metadata
Item Type: | Proceedings Paper |
---|---|
Authors/Creators: |
|
Copyright, Publisher and Additional Information: | © 2024 The Author(s). Except as otherwise noted, this author-accepted version of a paper published in 2024 IEEE International Conference on Software Maintenance and Evolution (ICSME) is made available via the University of Sheffield Research Publications and Copyright Policy under the terms of the Creative Commons Attribution 4.0 International License (CC-BY 4.0), which permits unrestricted use, distribution and reproduction in any medium, provided the original work is properly cited. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/ |
Keywords: | Surveys; Java; Software maintenance; Codes; Production; Manuals; Computer architecture; Writing; Testing; Access Modifiers; Code Coverage; Test Smells; Unit Testing |
Dates: |
|
Institution: | The University of Sheffield |
Academic Units: | The University of Sheffield > Faculty of Engineering (Sheffield) > Department of Computer Science (Sheffield) |
Funding Information: | Funder Grant number ENGINEERING AND PHYSICAL SCIENCE RESEARCH COUNCIL EP/X024539/1 |
Depositing User: | Symplectic Sheffield |
Date Deposited: | 06 Sep 2024 13:38 |
Last Modified: | 06 Jan 2025 15:57 |
Status: | Published |
Publisher: | Institute of Electrical and Electronics Engineers (IEEE) |
Refereed: | Yes |
Identification Number: | 10.1109/ICSME58944.2024.00101 |
Related URLs: | |
Open Archives Initiative ID (OAI ID): | oai:eprints.whiterose.ac.uk:216883 |